Advance Wayland and KDE package bring-up
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@@ -0,0 +1,9 @@
|
||||
# clang-format
|
||||
fa555b3c75a9f1b9940f0abac7729679c35173af
|
||||
43bc90ba2ae813d9e0d5cf3e6e50570da1c87caa
|
||||
|
||||
#clang-tidy
|
||||
fb6ba49bf944bab53123cc8011898af15b1c7c17
|
||||
|
||||
#astyle
|
||||
0b8696343af10941c962f054c5dd7c8fe501182b
|
||||
@@ -0,0 +1,29 @@
|
||||
# Ignore the following files
|
||||
*~
|
||||
*.[oa]
|
||||
*.diff
|
||||
*.kate-swp
|
||||
*.kdev4
|
||||
.kdev_include_paths
|
||||
*.kdevelop.pcs
|
||||
*.moc
|
||||
*.moc.cpp
|
||||
*.orig
|
||||
*.user
|
||||
.*.swp
|
||||
.swp.*
|
||||
Doxyfile
|
||||
Makefile
|
||||
avail
|
||||
random_seed
|
||||
/build*/
|
||||
CMakeLists.txt.user*
|
||||
*.unc-backup*
|
||||
.cmake/
|
||||
/.clang-format
|
||||
/compile_commands.json
|
||||
.clangd
|
||||
.idea
|
||||
.vscode
|
||||
/cmake-build*
|
||||
.cache
|
||||
@@ -0,0 +1,11 @@
|
||||
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include:
|
||||
- project: sysadmin/ci-utilities
|
||||
file:
|
||||
- /gitlab-templates/linux-qt6.yml
|
||||
- /gitlab-templates/linux-qt6-static.yml
|
||||
- /gitlab-templates/android-qt6.yml
|
||||
- /gitlab-templates/freebsd-qt6.yml
|
||||
- /gitlab-templates/windows-qt6.yml
|
||||
@@ -0,0 +1,19 @@
|
||||
Dependencies:
|
||||
- 'on': ['@all']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@same'
|
||||
'frameworks/kitemviews' : '@same'
|
||||
'frameworks/kconfig' : '@same'
|
||||
'frameworks/kconfigwidgets' : '@same'
|
||||
'frameworks/ki18n' : '@same'
|
||||
'frameworks/kiconthemes' : '@same'
|
||||
'frameworks/ktextwidgets' : '@same'
|
||||
'frameworks/kwidgetsaddons' : '@same'
|
||||
|
||||
- 'on': ['Linux', 'FreeBSD']
|
||||
'require':
|
||||
'frameworks/kglobalaccel' : '@same'
|
||||
|
||||
Options:
|
||||
test-before-installing: True
|
||||
require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
|
||||
@@ -0,0 +1,148 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(KF_VERSION "6.10.0") # handled by release scripts
|
||||
set(KF_DEP_VERSION "6.10.0") # handled by release scripts
|
||||
project(KXmlGui VERSION ${KF_VERSION})
|
||||
|
||||
# ECM setup
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 6.10.0 NO_MODULE)
|
||||
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
|
||||
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
|
||||
include(ECMMarkNonGuiExecutable)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMGenerateHeaders)
|
||||
include(ECMAddQch)
|
||||
include(ECMGenerateExportHeader)
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
||||
include(KDECMakeSettings)
|
||||
include(KDEGitCommitHooks)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(ECMDeprecationSettings)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
set(kxmlgui_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/kxmlgui_version.h")
|
||||
ecm_setup_version(PROJECT
|
||||
VARIABLE_PREFIX KXMLGUI
|
||||
VERSION_HEADER "${kxmlgui_version_header}"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6XmlGuiConfigVersion.cmake"
|
||||
SOVERSION 6)
|
||||
|
||||
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
|
||||
|
||||
option(FORCE_DISABLE_KGLOBALACCEL "Force building KXmlGui without KGlobalAccel. Doing this will break global shortcut support. [default=OFF]" OFF)
|
||||
option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
|
||||
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
|
||||
|
||||
cmake_dependent_option(BUILD_DESIGNERPLUGIN "Build plugin for Qt Designer" ON "NOT CMAKE_CROSSCOMPILING" OFF)
|
||||
add_feature_info(DESIGNERPLUGIN ${BUILD_DESIGNERPLUGIN} "Build plugin for Qt Designer")
|
||||
|
||||
# Dependencies
|
||||
set(REQUIRED_QT_VERSION 6.6.0)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets Xml )
|
||||
|
||||
# shall we use DBus?
|
||||
# enabled per default on Linux & BSD systems
|
||||
set(USE_DBUS_DEFAULT OFF)
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAIKU)
|
||||
set(USE_DBUS_DEFAULT ON)
|
||||
endif()
|
||||
option(USE_DBUS "Build components using DBus" ${USE_DBUS_DEFAULT})
|
||||
if(USE_DBUS)
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus)
|
||||
set(HAVE_QTDBUS ${Qt6DBus_FOUND})
|
||||
|
||||
# needs DBus + is only available on Linux & BSD
|
||||
if (NOT FORCE_DISABLE_KGLOBALACCEL AND NOT WIN32 AND NOT APPLE AND NOT ANDROID AND NOT HAIKU)
|
||||
find_package(KF6GlobalAccel ${KF_DEP_VERSION} REQUIRED)
|
||||
set (HAVE_GLOBALACCEL ${KF6GlobalAccel_FOUND})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(KF6CoreAddons ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6ItemViews ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6Config ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6ConfigWidgets ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6GuiAddons ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6I18n ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6IconThemes ${KF_DEP_VERSION} REQUIRED)
|
||||
find_package(KF6WidgetsAddons ${KF_DEP_VERSION} REQUIRED)
|
||||
|
||||
# For the Python bindings
|
||||
find_package(Python3 3.10 COMPONENTS Interpreter Development)
|
||||
find_package(Shiboken6)
|
||||
find_package(PySide6)
|
||||
|
||||
ecm_set_disabled_deprecation_versions(
|
||||
QT 6.8
|
||||
KF 6.8
|
||||
)
|
||||
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"kxmlgui6\")
|
||||
#ki18n_install(po)
|
||||
|
||||
cmake_dependent_option(BUILD_PYTHON_BINDINGS "Generate Python Bindings" ON "TARGET Shiboken6::libshiboken AND TARGET PySide6::pyside6" OFF)
|
||||
add_feature_info(PYTHON_BINDINGS ${BUILD_PYTHON_BINDINGS} "Python bindings")
|
||||
|
||||
# FreeBSD CI is missing required packages
|
||||
if (CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||
set(BUILD_PYTHON_BINDINGS OFF)
|
||||
endif()
|
||||
|
||||
# Subdirectories
|
||||
add_subdirectory(src)
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(autotests)
|
||||
endif()
|
||||
|
||||
if (BUILD_PYTHON_BINDINGS)
|
||||
include(ECMGeneratePythonBindings)
|
||||
add_subdirectory(python)
|
||||
endif()
|
||||
|
||||
# create a Config.cmake and a ConfigVersion.cmake file and install them
|
||||
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6XmlGui")
|
||||
|
||||
if (BUILD_QCH)
|
||||
ecm_install_qch_export(
|
||||
TARGETS KF6XmlGui_QCH
|
||||
FILE KF6XmlGuiQchTargets.cmake
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF6XmlGuiQchTargets.cmake\")")
|
||||
endif()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/KF6XmlGuiConfig.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF6XmlGuiConfig.cmake"
|
||||
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF6XmlGuiConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/KF6XmlGuiConfigVersion.cmake"
|
||||
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
install(EXPORT KF6XmlGuiTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF6XmlGuiTargets.cmake NAMESPACE KF6:: )
|
||||
|
||||
install(FILES
|
||||
${kxmlgui_version_header}
|
||||
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KXmlGui COMPONENT Devel
|
||||
)
|
||||
|
||||
include(ECMFeatureSummary)
|
||||
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
||||
@@ -0,0 +1,30 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
if (@HAVE_QTDBUS@)
|
||||
find_dependency(Qt6DBus @REQUIRED_QT_VERSION@)
|
||||
endif()
|
||||
find_dependency(Qt6Widgets @REQUIRED_QT_VERSION@)
|
||||
find_dependency(Qt6Xml @REQUIRED_QT_VERSION@)
|
||||
|
||||
find_dependency(KF6Config "@KF_DEP_VERSION@")
|
||||
find_dependency(KF6ConfigWidgets "@KF_DEP_VERSION@")
|
||||
|
||||
if (NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency(Qt6Network "@REQUIRED_QT_VERSION@")
|
||||
find_dependency(Qt6PrintSupport "@REQUIRED_QT_VERSION@")
|
||||
|
||||
if (@KF6GlobalAccel_FOUND@)
|
||||
find_dependency(KF6GlobalAccel "@KF_DEP_VERSION@")
|
||||
endif()
|
||||
|
||||
find_dependency(KF6CoreAddons "@KF_DEP_VERSION@")
|
||||
find_dependency(KF6GuiAddons "@KF_DEP_VERSION@")
|
||||
find_dependency(KF6WidgetsAddons "@KF_DEP_VERSION@")
|
||||
find_dependency(KF6ItemViews "@KF_DEP_VERSION@")
|
||||
find_dependency(KF6I18n "@KF_DEP_VERSION@")
|
||||
find_dependency(KF6IconThemes "@KF_DEP_VERSION@")
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/KF6XmlGuiTargets.cmake")
|
||||
@PACKAGE_INCLUDE_QCHTARGETS@
|
||||
@@ -0,0 +1,9 @@
|
||||
Copyright (c) <year> <owner> All rights reserved.
|
||||
|
||||
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 above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
@@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
@@ -0,0 +1,446 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,446 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,467 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts as the
|
||||
successor of the GNU Library Public License, version 2, hence the version
|
||||
number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some specially
|
||||
designated software packages--typically libraries--of the Free Software Foundation
|
||||
and other authors who decide to use it. You can use it too, but we suggest
|
||||
you first think carefully about whether this license or the ordinary General
|
||||
Public License is the better strategy to use in any particular case, based
|
||||
on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use, not price.
|
||||
Our General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish); that you receive source code or can get it if you want it; that you
|
||||
can change the software and use pieces of it in new free programs; and that
|
||||
you are informed that you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid distributors
|
||||
to deny you these rights or to ask you to surrender these rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
other code with the library, you must provide complete object files to the
|
||||
recipients, so that they can relink them with the library after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the library,
|
||||
and (2) we offer you this license, which gives you legal permission to copy,
|
||||
distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that there is no
|
||||
warranty for the free library. Also, if the library is modified by someone
|
||||
else and passed on, the recipients should know that what they have is not
|
||||
the original version, so that the original author's reputation will not be
|
||||
affected by problems that might be introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of any free
|
||||
program. We wish to make sure that a company cannot effectively restrict the
|
||||
users of a free program by obtaining a restrictive license from a patent holder.
|
||||
Therefore, we insist that any patent license obtained for a version of the
|
||||
library must be consistent with the full freedom of use specified in this
|
||||
license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License. This license, the GNU Lesser General Public License,
|
||||
applies to certain designated libraries, and is quite different from the ordinary
|
||||
General Public License. We use this license for certain libraries in order
|
||||
to permit linking those libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using a shared
|
||||
library, the combination of the two is legally speaking a combined work, a
|
||||
derivative of the original library. The ordinary General Public License therefore
|
||||
permits such linking only if the entire combination fits its criteria of freedom.
|
||||
The Lesser General Public License permits more lax criteria for linking other
|
||||
code with the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it does Less
|
||||
to protect the user's freedom than the ordinary General Public License. It
|
||||
also provides other free software developers Less of an advantage over competing
|
||||
non-free programs. These disadvantages are the reason we use the ordinary
|
||||
General Public License for many libraries. However, the Lesser license provides
|
||||
advantages in certain special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to encourage the
|
||||
widest possible use of a certain library, so that it becomes a de-facto standard.
|
||||
To achieve this, non-free programs must be allowed to use the library. A more
|
||||
frequent case is that a free library does the same job as widely used non-free
|
||||
libraries. In this case, there is little to gain by limiting the free library
|
||||
to free software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free programs
|
||||
enables a greater number of people to use a large body of free software. For
|
||||
example, permission to use the GNU C Library in non-free programs enables
|
||||
many more people to use the whole GNU operating system, as well as its variant,
|
||||
the GNU/Linux operating system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the users'
|
||||
freedom, it does ensure that the user of a program that is linked with the
|
||||
Library has the freedom and the wherewithal to run that program using a modified
|
||||
version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, whereas the latter must be combined with the library in
|
||||
order to run.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Lesser General
|
||||
Public License (also called "this License"). Each licensee is addressed as
|
||||
"you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the library
|
||||
already present on the user's computer system, rather than copying library
|
||||
functions into the executable, and (2) will operate properly with a modified
|
||||
version of the library, if the user installs one, as long as the modified
|
||||
version is interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the materials to be distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties with this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
< one line to give the library's name and an idea of what it does. >
|
||||
|
||||
Copyright (C) < year > < name of author >
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information
|
||||
on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
< signature of Ty Coon > , 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,468 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts as the
|
||||
successor of the GNU Library Public License, version 2, hence the version
|
||||
number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some specially
|
||||
designated software packages--typically libraries--of the Free Software Foundation
|
||||
and other authors who decide to use it. You can use it too, but we suggest
|
||||
you first think carefully about whether this license or the ordinary General
|
||||
Public License is the better strategy to use in any particular case, based
|
||||
on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use, not price.
|
||||
Our General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish); that you receive source code or can get it if you want it; that you
|
||||
can change the software and use pieces of it in new free programs; and that
|
||||
you are informed that you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid distributors
|
||||
to deny you these rights or to ask you to surrender these rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
other code with the library, you must provide complete object files to the
|
||||
recipients, so that they can relink them with the library after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the library,
|
||||
and (2) we offer you this license, which gives you legal permission to copy,
|
||||
distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that there is no
|
||||
warranty for the free library. Also, if the library is modified by someone
|
||||
else and passed on, the recipients should know that what they have is not
|
||||
the original version, so that the original author's reputation will not be
|
||||
affected by problems that might be introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of any free
|
||||
program. We wish to make sure that a company cannot effectively restrict the
|
||||
users of a free program by obtaining a restrictive license from a patent holder.
|
||||
Therefore, we insist that any patent license obtained for a version of the
|
||||
library must be consistent with the full freedom of use specified in this
|
||||
license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License. This license, the GNU Lesser General Public License,
|
||||
applies to certain designated libraries, and is quite different from the ordinary
|
||||
General Public License. We use this license for certain libraries in order
|
||||
to permit linking those libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using a shared
|
||||
library, the combination of the two is legally speaking a combined work, a
|
||||
derivative of the original library. The ordinary General Public License therefore
|
||||
permits such linking only if the entire combination fits its criteria of freedom.
|
||||
The Lesser General Public License permits more lax criteria for linking other
|
||||
code with the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it does Less
|
||||
to protect the user's freedom than the ordinary General Public License. It
|
||||
also provides other free software developers Less of an advantage over competing
|
||||
non-free programs. These disadvantages are the reason we use the ordinary
|
||||
General Public License for many libraries. However, the Lesser license provides
|
||||
advantages in certain special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to encourage the
|
||||
widest possible use of a certain library, so that it becomes a de-facto standard.
|
||||
To achieve this, non-free programs must be allowed to use the library. A more
|
||||
frequent case is that a free library does the same job as widely used non-free
|
||||
libraries. In this case, there is little to gain by limiting the free library
|
||||
to free software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free programs
|
||||
enables a greater number of people to use a large body of free software. For
|
||||
example, permission to use the GNU C Library in non-free programs enables
|
||||
many more people to use the whole GNU operating system, as well as its variant,
|
||||
the GNU/Linux operating system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the users'
|
||||
freedom, it does ensure that the user of a program that is linked with the
|
||||
Library has the freedom and the wherewithal to run that program using a modified
|
||||
version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, whereas the latter must be combined with the library in
|
||||
order to run.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Lesser General
|
||||
Public License (also called "this License"). Each licensee is addressed as
|
||||
"you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the library
|
||||
already present on the user's computer system, rather than copying library
|
||||
functions into the executable, and (2) will operate properly with a modified
|
||||
version of the library, if the user installs one, as long as the modified
|
||||
version is interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the materials to be distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties with this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and an idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
< signature of Ty Coon > , 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -0,0 +1,163 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates the terms
|
||||
and conditions of version 3 of the GNU General Public License, supplemented
|
||||
by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser General
|
||||
Public License, and the "GNU GPL" refers to version 3 of the GNU General Public
|
||||
License.
|
||||
|
||||
|
||||
|
||||
"The Library" refers to a covered work governed by this License, other than
|
||||
an Application or a Combined Work as defined below.
|
||||
|
||||
|
||||
|
||||
An "Application" is any work that makes use of an interface provided by the
|
||||
Library, but which is not otherwise based on the Library. Defining a subclass
|
||||
of a class defined by the Library is deemed a mode of using an interface provided
|
||||
by the Library.
|
||||
|
||||
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an Application
|
||||
with the Library. The particular version of the Library with which the Combined
|
||||
Work was made is also called the "Linked Version".
|
||||
|
||||
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the Corresponding
|
||||
Source for the Combined Work, excluding any source code for portions of the
|
||||
Combined Work that, considered in isolation, are based on the Application,
|
||||
and not on the Linked Version.
|
||||
|
||||
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the object
|
||||
code and/or source code for the Application, including any data and utility
|
||||
programs needed for reproducing the Combined Work from the Application, but
|
||||
excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License without
|
||||
being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a facility
|
||||
refers to a function or data to be supplied by an Application that uses the
|
||||
facility (other than as an argument passed when the facility is invoked),
|
||||
then you may convey a copy of the modified version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to ensure
|
||||
that, in the event an Application does not supply the function or data, the
|
||||
facility still operates, and performs whatever part of its purpose remains
|
||||
meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of this License
|
||||
applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from a header
|
||||
file that is part of the Library. You may convey such object code under terms
|
||||
of your choice, provided that, if the incorporated material is not limited
|
||||
to numerical parameters, data structure layouts and accessors, or small macros,
|
||||
inline functions and templates (ten or fewer lines in length), you do both
|
||||
of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that, taken together,
|
||||
effectively do not restrict modification of the portions of the Library contained
|
||||
in the Combined Work and reverse engineering for debugging such modifications,
|
||||
if you also do each of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during execution, include
|
||||
the copyright notice for the Library among these notices, as well as a reference
|
||||
directing the user to the copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this License,
|
||||
and the Corresponding Application Code in a form suitable for, and under terms
|
||||
that permit, the user to recombine or relink the Application with a modified
|
||||
version of the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (a) uses at run time a copy of the Library
|
||||
already present on the user's computer system, and (b) will operate properly
|
||||
with a modified version of the Library that is interface-compatible with the
|
||||
Linked Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise be required
|
||||
to provide such information under section 6 of the GNU GPL, and only to the
|
||||
extent that such information is necessary to install and execute a modified
|
||||
version of the Combined Work produced by recombining or relinking the Application
|
||||
with a modified version of the Linked Version. (If you use option 4d0, the
|
||||
Installation Information must accompany the Minimal Corresponding Source and
|
||||
Corresponding Application Code. If you use option 4d1, you must provide the
|
||||
Installation Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the Library side
|
||||
by side in a single library together with other library facilities that are
|
||||
not Applications and are not covered by this License, and convey such a combined
|
||||
library under terms of your choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities, conveyed under the
|
||||
terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it is a work
|
||||
based on the Library, and explaining where to find the accompanying uncombined
|
||||
form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library as you
|
||||
received it specifies that a certain numbered version of the GNU Lesser General
|
||||
Public License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that published version or of
|
||||
any later version published by the Free Software Foundation. If the Library
|
||||
as you received it does not specify a version number of the GNU Lesser General
|
||||
Public License, you may choose any version of the GNU Lesser General Public
|
||||
License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide whether
|
||||
future versions of the GNU Lesser General Public License shall apply, that
|
||||
proxy's public statement of acceptance of any version is permanent authorization
|
||||
for you to choose that version for the Library.
|
||||
@@ -0,0 +1,12 @@
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the license or (at your option) any later version
|
||||
that is accepted by the membership of KDE e.V. (or its successor
|
||||
approved by the membership of KDE e.V.), which shall act as a
|
||||
proxy as defined in Section 6 of version 3 of the license.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
@@ -0,0 +1,24 @@
|
||||
# KXMLGUI
|
||||
|
||||
Framework for managing menu and toolbar actions
|
||||
|
||||
## Introduction
|
||||
|
||||
KXMLGUI provides a framework for managing menu and toolbar actions in an
|
||||
abstract way. The actions are configured through a XML description and hooks
|
||||
in the application code. The framework supports merging of multiple
|
||||
description for example for integrating actions from plugins.
|
||||
|
||||
## Kiosk
|
||||
|
||||
KXMLGui makes use of the Kiosk authorization functionality of KConfig (see the
|
||||
KAuthorized namespace in that framework). Notably, QAction instances added to a
|
||||
KActionCollection are disabled if KAuthorized::authorizeAction() reports that
|
||||
they are not authorized. The items on the standard help menu (KHelpMenu) can
|
||||
likewise be disabled based on Kiosk settings, and toolbar editing can be
|
||||
restricted.
|
||||
|
||||
See KActionCollection, KHelpMenu and KToolBar documentation for more
|
||||
information.
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
Bug with toolbars: a->saveState(); delete a; b->saveState(); delete b;
|
||||
will store wrong positions (index, offset and newline).
|
||||
When removing an xmlgui-client involves destroying toolbars, we need to save the
|
||||
whole set of toolbar positions of the mainwindow, into the xmlgui-client.
|
||||
|
||||
Data structure:
|
||||
struct KToolBarPos {
|
||||
short int index;
|
||||
short int offset;
|
||||
bool newLine;
|
||||
};
|
||||
typedef QValueVector<KToolBarPos> KToolBarPosList;
|
||||
|
||||
API:
|
||||
KToolBarPosList KMainWindow::toolBarPositionList() const;
|
||||
|
||||
The remaining problem is to know when to call it:
|
||||
* when we know in advance that we'll be able to remove toolbars?
|
||||
(when creating the client we could remember if we created a toolbar and store
|
||||
that bit of information, to re-use it when removing the client again)
|
||||
* when removing the first toolbar (of a given client); then we need
|
||||
to differentiate between first and following toolbars
|
||||
* always, if fast enough? With tons of plugins that might not be a good idea.
|
||||
|
||||
========== More long term
|
||||
|
||||
Problems:
|
||||
* No ui_standards.rc merging for parts
|
||||
* Confusing tag names (MergeLocal vs DefineGroup) for similar features
|
||||
* Two different merging codes (DOM-tree merging for ui_standards, xmlguifactory merging
|
||||
between xmlguiclients).
|
||||
|
||||
Solution:
|
||||
* Get rid of the custom DOM-tree merging code from kxmlguiclient (for ui_standards.rc),
|
||||
use the existing merging code from kxmlguifactory instead
|
||||
* MergeLocal and DefineGroup are renamed MergeGroup, and append= becomes equivalent to group=.
|
||||
* Action is renamed MergeAction, and uses a new kind of place holder
|
||||
(one that matches actions by name during merging)
|
||||
So ui_standards.rc needs to be turned into <MergeAction>s and <MergeGroup>s only.
|
||||
* This also means that it will be possible to have only merge tags (and custom items
|
||||
like separators and tearoffhandle etc.) in a container, in which case it should
|
||||
not appear in the GUI. For that, ContainerNode must be improved so that it supports
|
||||
having no real GUI container attached to it.
|
||||
Big problem here. This means not building a container until we find that it
|
||||
really has an action (and the other way round: deleting a container when
|
||||
removing its last action, as we do, but still keeping a ContainerNode around...)
|
||||
(A ContainerNode is destroyed when its owner guiclient is removed from the factory,
|
||||
no change here).
|
||||
|
||||
* A new XMLGUIClient provides the ui_standards.rc XML. It has the same instance
|
||||
as the mainwindow's guiclient. It provides no actions. No problems, since it
|
||||
only has <Merge*> tags.
|
||||
|
||||
But that new xmlguiclient will 'own' the containers, so KEditToolbar will
|
||||
give wrong information.
|
||||
|
||||
=====>
|
||||
This means the following KEditToolbar improvement is necessary:
|
||||
(it's an almost unrelated and necessary change there anyway, usability-wise)
|
||||
|
||||
It would use merging, to present a merged view of the toolbars
|
||||
When the user inserts an action to a toolbar, we know which client the action
|
||||
belongs to, so we know which XML file to modify.
|
||||
BUT if the user adds actions in non-contiguous positions, we need to
|
||||
create <DefineGroup name="client1_tmp1"> groups, so that the merging actually does
|
||||
what the user asked for (!!)
|
||||
|
||||
This allows to get rid of the "toolbar <client>" combobox stuff, and just have
|
||||
a list of toolbars there.
|
||||
|
||||
Implementation: it can do this by providing its own KXMLGUIBuilder, to a
|
||||
new factory. The guiclients would be wrapped in a KXMLGUIClientProxy,
|
||||
which would forward the action() and domElement() calls - because a client
|
||||
can be in only one factory at a time.
|
||||
|
||||
This custom builder needs to know about action plugging too, we don't really want
|
||||
to call KAction::plug here. So this would be 'virtualized' (new virtual, in a new
|
||||
interface to keep BC, that by default calls plug, but does something else in
|
||||
kedittoolbar's builder).
|
||||
|
||||
|
||||
======
|
||||
|
||||
Additional benefits:
|
||||
* Any XML file can use the new <MergeAction> feature to modify the way a
|
||||
child client (e.g. a part) is getting merged, without adding group attributes
|
||||
to the child client (useful for a binary-only one, e.g.)
|
||||
|
||||
--
|
||||
David Faure <faure@kde.org>
|
||||
Simon Hausmann <hausmann@kde.org>
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Xml Test)
|
||||
|
||||
include(ECMAddTests)
|
||||
|
||||
if (HAVE_QTDBUS)
|
||||
add_definitions(-DWITH_QTDBUS)
|
||||
endif()
|
||||
|
||||
ecm_add_tests(
|
||||
kactioncategorytest.cpp
|
||||
kactioncollectiontest.cpp
|
||||
LINK_LIBRARIES Qt6::Test KF6::XmlGui
|
||||
)
|
||||
ecm_add_tests(
|
||||
kmainwindow_unittest.cpp
|
||||
ktoolbar_unittest.cpp
|
||||
ktooltiphelper_unittest.cpp
|
||||
kxmlgui_unittest.cpp
|
||||
GUI
|
||||
LINK_LIBRARIES Qt6::Test KF6::IconThemes KF6::XmlGui
|
||||
)
|
||||
|
||||
set_tests_properties(ktoolbar_unittest PROPERTIES RUN_SERIAL TRUE) # it wipes out ~/.qttest/share
|
||||
|
After Width: | Height: | Size: 672 B |
|
After Width: | Height: | Size: 929 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,504 @@
|
||||
[Icon Theme]
|
||||
Name=Oxygen
|
||||
Name[ar]=أوكسجين
|
||||
Name[ast]=Oxygen
|
||||
Name[bs]=Oxygen
|
||||
Name[ca]=Oxygen
|
||||
Name[ca@valencia]=Oxygen
|
||||
Name[cs]=Oxygen
|
||||
Name[da]=Oxygen
|
||||
Name[de]=Oxygen
|
||||
Name[el]=Oxygen
|
||||
Name[en_GB]=Oxygen
|
||||
Name[es]=Oxígeno
|
||||
Name[fa]=اکسیژن
|
||||
Name[fi]=Oxygen
|
||||
Name[fr]=Oxygen
|
||||
Name[ga]=Oxygen
|
||||
Name[gd]=Oxygen
|
||||
Name[gl]=Oxygen
|
||||
Name[hu]=Oxygen
|
||||
Name[ia]=Oxygen
|
||||
Name[it]=Oxygen
|
||||
Name[ko]=Oxygen
|
||||
Name[lt]=Oxygen
|
||||
Name[nb]=Oxygen
|
||||
Name[nds]=Oxygen
|
||||
Name[nl]=Oxygen
|
||||
Name[nn]=Oxygen
|
||||
Name[pa]=ਆਕਸੀਜਨ
|
||||
Name[pl]=Tlen
|
||||
Name[pt]=Oxygen
|
||||
Name[pt_BR]=Oxygen
|
||||
Name[ro]=Oxygen
|
||||
Name[ru]=Oxygen
|
||||
Name[se]=Oksygena
|
||||
Name[sk]=Oxygen
|
||||
Name[sl]=Kisik
|
||||
Name[sr]=Кисеоник
|
||||
Name[sr@ijekavian]=Кисеоник
|
||||
Name[sr@ijekavianlatin]=Kiseonik
|
||||
Name[sr@latin]=Kiseonik
|
||||
Name[sv]=Oxygen
|
||||
Name[tr]=Oxygen
|
||||
Name[uk]=Oxygen
|
||||
Name[vi]=Oxy
|
||||
Name[x-test]=xxOxygenxx
|
||||
Name[zh_CN]=Oxygen
|
||||
Name[zh_TW]=Oxygen
|
||||
|
||||
Comment=Oxygen Team
|
||||
Comment[ar]=فريق أوكسجين
|
||||
Comment[ast]=L'equipu Oxygen
|
||||
Comment[bs]=Oxygen tim
|
||||
Comment[ca]=Equip de l'Oxygen
|
||||
Comment[ca@valencia]=Equip de l'Oxygen
|
||||
Comment[cs]=Tým Oxygen
|
||||
Comment[da]=Oxygen-holdet
|
||||
Comment[de]=Oxygen-Team
|
||||
Comment[el]=Η ομάδα του Oxygen
|
||||
Comment[en_GB]=Oxygen Team
|
||||
Comment[es]=Equipo de Oxígeno
|
||||
Comment[fa]=تیم اکسیژن
|
||||
Comment[fi]=Oxygenin kehitysryhmä
|
||||
Comment[fr]=Équipe de « Oxygen »
|
||||
Comment[gd]=An Sgioba Oxygen
|
||||
Comment[gl]=Equipo de Oxygen
|
||||
Comment[hu]=Oxygen csapat
|
||||
Comment[ia]=Equipa de Oxygen
|
||||
Comment[it]=Squadra di Oxygen
|
||||
Comment[ko]=Oxygen 팀
|
||||
Comment[lt]=Oxygen komanda
|
||||
Comment[nb]=Oxygen-laget
|
||||
Comment[nds]=Oxygen-Koppel
|
||||
Comment[nl]=Oxygen-team
|
||||
Comment[nn]=Oxygen-laget
|
||||
Comment[pa]=ਆਕਸੀਜਨ ਟੀਮ
|
||||
Comment[pl]=Zespół Oxygen
|
||||
Comment[pt]=Equipa do Oxygen
|
||||
Comment[pt_BR]=Equipe do Oxygen
|
||||
Comment[ro]=Echipa Oxygen
|
||||
Comment[ru]=Команда Oxygen
|
||||
Comment[sk]=Tím Oxygen
|
||||
Comment[sl]=Ekipa Kisika
|
||||
Comment[sr]=Тим Кисеоника
|
||||
Comment[sr@ijekavian]=Тим Кисеоника
|
||||
Comment[sr@ijekavianlatin]=Tim Kiseonika
|
||||
Comment[sr@latin]=Tim Kiseonika
|
||||
Comment[sv]=Oxygen-gruppen
|
||||
Comment[tr]=Oxygen Takımı
|
||||
Comment[uk]=Команда Oxygen
|
||||
Comment[x-test]=xxOxygen Teamxx
|
||||
Comment[zh_CN]=Oxygen 团队
|
||||
Comment[zh_TW]=Oxygen 開發團隊
|
||||
|
||||
DisplayDepth=32
|
||||
|
||||
Inherits=hicolor
|
||||
|
||||
Example=folder
|
||||
|
||||
LinkOverlay=link
|
||||
LockOverlay=lockoverlay
|
||||
ShareOverlay=share
|
||||
ZipOverlay=zip
|
||||
|
||||
DesktopDefault=48
|
||||
DesktopSizes=16,22,32,48,64,128,256
|
||||
ToolbarDefault=22
|
||||
ToolbarSizes=16,22,32,48
|
||||
MainToolbarDefault=22
|
||||
MainToolbarSizes=16,22,32,48
|
||||
SmallDefault=16
|
||||
SmallSizes=16,22,32,48
|
||||
PanelDefault=32
|
||||
PanelSizes=16,22,32,48,64,128,256
|
||||
DialogDefault=32
|
||||
DialogSizes=16,22,32,48,64,128,256
|
||||
|
||||
Directories=8x8/emblems,16x16/actions,16x16/animations,16x16/apps,16x16/categories,16x16/devices,16x16/emblems,16x16/emotes,16x16/intl,16x16/mimetypes,16x16/places,16x16/status,16x16/special,22x22/actions,22x22/animations,22x22/apps,22x22/categories,22x22/devices,22x22/emblems,22x22/emotes,22x22/intl,22x22/mimetypes,22x22/places,22x22/status,22x22/special,32x32/actions,32x32/animations,32x32/apps,32x32/categories,32x32/devices,32x32/emblems,32x32/emotes,32x32/intl,32x32/mimetypes,32x32/places,32x32/status,48x48/actions,48x48/animations,48x48/apps,48x48/categories,48x48/devices,48x48/emblems,48x48/emotes,48x48/intl,48x48/mimetypes,48x48/places,48x48/status,64x64/actions,64x64/animations,64x64/apps,64x64/categories,64x64/devices,64x64/emblems,64x64/emotes,64x64/intl,64x64/mimetypes,64x64/places,64x64/status,128x128/actions,128x128/animations,128x128/apps,128x128/categories,128x128/devices,128x128/emblems,128x128/emotes,128x128/intl,128x128/mimetypes,128x128/places,128x128/status,256x256/actions,256x256/apps,256x256/categories,256x256/devices,256x256/mimetypes,256x256/places,256x256/status
|
||||
|
||||
[8x8/emblems]
|
||||
Size=8
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[16x16/actions]
|
||||
Size=16
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[16x16/animations]
|
||||
Size=16
|
||||
Context=Animations
|
||||
Type=Threshold
|
||||
|
||||
[16x16/apps]
|
||||
Size=16
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[16x16/categories]
|
||||
Size=16
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[16x16/devices]
|
||||
Size=16
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[16x16/emblems]
|
||||
Size=16
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[16x16/emotes]
|
||||
Size=16
|
||||
Context=Emotes
|
||||
Type=Threshold
|
||||
|
||||
[16x16/intl]
|
||||
Size=16
|
||||
Context=International
|
||||
Type=Threshold
|
||||
|
||||
[16x16/mimetypes]
|
||||
Size=16
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[16x16/places]
|
||||
Size=16
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[16x16/status]
|
||||
Size=16
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
|
||||
[16x16/special]
|
||||
Size=16
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[22x22/actions]
|
||||
Size=22
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[22x22/animations]
|
||||
Size=22
|
||||
Context=Animations
|
||||
Type=Threshold
|
||||
|
||||
[22x22/apps]
|
||||
Size=22
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[22x22/categories]
|
||||
Size=22
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[22x22/devices]
|
||||
Size=22
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[22x22/emblems]
|
||||
Size=22
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[22x22/emotes]
|
||||
Size=22
|
||||
Context=Emotes
|
||||
Type=Threshold
|
||||
|
||||
[22x22/intl]
|
||||
Size=22
|
||||
Context=International
|
||||
Type=Threshold
|
||||
|
||||
[22x22/mimetypes]
|
||||
Size=22
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[22x22/places]
|
||||
Size=22
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[22x22/status]
|
||||
Size=22
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
|
||||
[22x22/special]
|
||||
Size=22
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[32x32/actions]
|
||||
Size=32
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[32x32/animations]
|
||||
Size=32
|
||||
Context=Animations
|
||||
Type=Threshold
|
||||
|
||||
[32x32/apps]
|
||||
Size=32
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[32x32/categories]
|
||||
Size=32
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[32x32/devices]
|
||||
Size=32
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[32x32/emblems]
|
||||
Size=32
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[32x32/emotes]
|
||||
Size=32
|
||||
Context=Emotes
|
||||
Type=Threshold
|
||||
|
||||
[32x32/intl]
|
||||
Size=32
|
||||
Context=International
|
||||
Type=Threshold
|
||||
|
||||
[32x32/mimetypes]
|
||||
Size=32
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[32x32/places]
|
||||
Size=32
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[32x32/status]
|
||||
Size=32
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
|
||||
[48x48/actions]
|
||||
Size=48
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[48x48/animations]
|
||||
Size=48
|
||||
Context=Animations
|
||||
Type=Threshold
|
||||
|
||||
[48x48/apps]
|
||||
Size=48
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[48x48/categories]
|
||||
Size=48
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[48x48/devices]
|
||||
Size=48
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[48x48/emblems]
|
||||
Size=48
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[48x48/emotes]
|
||||
Size=48
|
||||
Context=Emotes
|
||||
Type=Threshold
|
||||
|
||||
[48x48/intl]
|
||||
Size=48
|
||||
Context=International
|
||||
Type=Threshold
|
||||
|
||||
[48x48/mimetypes]
|
||||
Size=48
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[48x48/places]
|
||||
Size=48
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[48x48/status]
|
||||
Size=48
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
|
||||
[64x64/actions]
|
||||
Size=64
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[64x64/animations]
|
||||
Size=64
|
||||
Context=Animations
|
||||
Type=Threshold
|
||||
|
||||
[64x64/apps]
|
||||
Size=64
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[64x64/categories]
|
||||
Size=64
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[64x64/devices]
|
||||
Size=64
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[64x64/emblems]
|
||||
Size=64
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[64x64/emotes]
|
||||
Size=64
|
||||
Context=Emotes
|
||||
Type=Threshold
|
||||
|
||||
[64x64/intl]
|
||||
Size=64
|
||||
Context=International
|
||||
Type=Threshold
|
||||
|
||||
[64x64/mimetypes]
|
||||
Size=64
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[64x64/places]
|
||||
Size=64
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[64x64/status]
|
||||
Size=64
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
|
||||
[128x128/actions]
|
||||
Size=128
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[128x128/animations]
|
||||
Size=128
|
||||
Context=Animations
|
||||
Type=Threshold
|
||||
|
||||
[128x128/apps]
|
||||
Size=128
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[128x128/categories]
|
||||
Size=128
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[128x128/devices]
|
||||
Size=128
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[128x128/emblems]
|
||||
Size=128
|
||||
Context=Emblems
|
||||
Type=Threshold
|
||||
|
||||
[128x128/emotes]
|
||||
Size=128
|
||||
Context=Emotes
|
||||
Type=Threshold
|
||||
|
||||
[128x128/categories]
|
||||
Size=128
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[128x128/intl]
|
||||
Size=128
|
||||
Context=International
|
||||
Type=Threshold
|
||||
|
||||
[128x128/mimetypes]
|
||||
Size=128
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[128x128/places]
|
||||
Size=128
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[128x128/status]
|
||||
Size=128
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
|
||||
[256x256/actions]
|
||||
Size=256
|
||||
Context=Actions
|
||||
Type=Threshold
|
||||
|
||||
[256x256/apps]
|
||||
Size=256
|
||||
Context=Applications
|
||||
Type=Threshold
|
||||
|
||||
[256x256/categories]
|
||||
Size=256
|
||||
Context=Categories
|
||||
Type=Threshold
|
||||
|
||||
[256x256/devices]
|
||||
Size=256
|
||||
Context=Devices
|
||||
Type=Threshold
|
||||
|
||||
[256x256/mimetypes]
|
||||
Size=256
|
||||
Context=MimeTypes
|
||||
Type=Threshold
|
||||
|
||||
[256x256/places]
|
||||
Size=256
|
||||
Context=Places
|
||||
Type=Threshold
|
||||
|
||||
[256x256/status]
|
||||
Size=256
|
||||
Context=Status
|
||||
Type=Threshold
|
||||
@@ -0,0 +1,160 @@
|
||||
#include "kactioncategorytest.h"
|
||||
|
||||
#include <QtTestWidgets>
|
||||
|
||||
#include "kactioncategory.h"
|
||||
#include "kactioncollection.h"
|
||||
#include <KSelectAction>
|
||||
#include <KStandardAction>
|
||||
|
||||
void tst_KActionCategory::tstCreation()
|
||||
{
|
||||
KActionCollection collection((QObject *)nullptr);
|
||||
KActionCategory category1(QStringLiteral("category1"), &collection);
|
||||
KActionCategory category2(QStringLiteral("category2"), &collection);
|
||||
|
||||
// Check that the name is correct
|
||||
QCOMPARE(category1.text(), QStringLiteral("category1"));
|
||||
QCOMPARE(category2.text(), QStringLiteral("category2"));
|
||||
|
||||
// Check that the parent is correct
|
||||
QCOMPARE(category1.collection(), &collection);
|
||||
QCOMPARE(category2.collection(), &collection);
|
||||
|
||||
// Check that the category is available as a child of the collection
|
||||
QList<KActionCategory *> categories = collection.findChildren<KActionCategory *>();
|
||||
QCOMPARE(categories.size(), 2);
|
||||
QCOMPARE(categories.count(&category1), 1);
|
||||
QCOMPARE(categories.count(&category2), 1);
|
||||
|
||||
// Change the text
|
||||
category1.setText(QStringLiteral("Other Text"));
|
||||
QCOMPARE(category1.text(), QStringLiteral("Other Text"));
|
||||
}
|
||||
|
||||
void tst_KActionCategory::tstSynchronization()
|
||||
{
|
||||
KActionCollection collection((QObject *)nullptr);
|
||||
KActionCategory category1(QStringLiteral("category1"), &collection);
|
||||
KActionCategory category2(QStringLiteral("category2"), &collection);
|
||||
|
||||
// The collection is empty
|
||||
QCOMPARE(collection.count(), 0);
|
||||
|
||||
// Now add a action to category1
|
||||
QAction *action1 = category1.addAction(QStringLiteral("action1"));
|
||||
// Check it was added to the category.
|
||||
QCOMPARE(category1.actions().count(), 1);
|
||||
QCOMPARE(category1.actions().count(action1), 1);
|
||||
// Check it was added to the collection
|
||||
QCOMPARE(collection.actions().count(), 1);
|
||||
QCOMPARE(collection.actions().count(action1), 1);
|
||||
|
||||
// Short intermezzo. Add the action a second time
|
||||
category1.addAction(QStringLiteral("action1_new"), action1);
|
||||
QCOMPARE(category1.actions().count(), 1);
|
||||
QCOMPARE(category1.actions().count(action1), 1);
|
||||
QCOMPARE(collection.actions().count(), 1);
|
||||
QCOMPARE(collection.actions().count(action1), 1);
|
||||
|
||||
// Now add a action to category2
|
||||
QAction *action2 = category2.addAction(QStringLiteral("action2"));
|
||||
// Check it was added to the category.
|
||||
QCOMPARE(category2.actions().count(), 1);
|
||||
QCOMPARE(category2.actions().count(action2), 1);
|
||||
// Check it was added to the collection
|
||||
QCOMPARE(collection.actions().count(), 2);
|
||||
QCOMPARE(collection.actions().count(action2), 1);
|
||||
|
||||
// Delete action1
|
||||
delete action1;
|
||||
// Check it was removed from the collection
|
||||
QCOMPARE(collection.actions().count(), 1);
|
||||
QCOMPARE(collection.actions().count(action1), 0);
|
||||
// Check it was removed from the category.
|
||||
QCOMPARE(category1.actions().count(), 0);
|
||||
QCOMPARE(category1.actions().count(action1), 0);
|
||||
|
||||
// Remove action2 from the collection
|
||||
collection.removeAction(action2);
|
||||
// Check it was removed from the collection
|
||||
QCOMPARE(collection.actions().count(), 0);
|
||||
QCOMPARE(collection.actions().count(action2), 0);
|
||||
// Check it was removed from the category.
|
||||
QCOMPARE(category2.actions().count(), 0);
|
||||
QCOMPARE(category2.actions().count(action2), 0);
|
||||
|
||||
// Create another category, add a action, delete the category and check
|
||||
// if the action is still part of the collection.
|
||||
KActionCategory *category3 = new KActionCategory(QStringLiteral("category3"), &collection);
|
||||
QAction *action3 = category3->addAction(QStringLiteral("action3"));
|
||||
// Check it was added to the collection
|
||||
QCOMPARE(collection.actions().count(action3), 1);
|
||||
// delete the category
|
||||
delete category3;
|
||||
// Make sure the action is still there.
|
||||
QCOMPARE(collection.actions().count(action3), 1);
|
||||
}
|
||||
|
||||
void tst_KActionCategory::tstActionCreation()
|
||||
{
|
||||
KActionCollection collection((QObject *)nullptr);
|
||||
KActionCategory category(QStringLiteral("category"), &collection);
|
||||
|
||||
// QAction * addAction(const QString &name, QAction *action);
|
||||
QAction *action1 = new QAction(nullptr);
|
||||
category.addAction(QStringLiteral("action1"), action1);
|
||||
QCOMPARE(category.actions().count(action1), 1);
|
||||
QCOMPARE(collection.actions().count(action1), 1);
|
||||
|
||||
// QAction * addAction(const QString &name, QAction *action);
|
||||
QAction *action2 = new QAction(nullptr);
|
||||
category.addAction(QStringLiteral("action2"), action2);
|
||||
QCOMPARE(category.actions().count(action2), 1);
|
||||
QCOMPARE(collection.actions().count(action2), 1);
|
||||
|
||||
// QAction * addAction(
|
||||
// KStandardAction::StandardAction actionType,
|
||||
// const QObject *receiver = NULL,
|
||||
// const char *member = NULL);
|
||||
QAction *action3 = category.addAction(KStandardAction::Revert);
|
||||
QCOMPARE(category.actions().count(action3), 1);
|
||||
QCOMPARE(collection.actions().count(action3), 1);
|
||||
|
||||
// QAction * addAction(
|
||||
// KStandardAction::StandardAction actionType,
|
||||
// const QString &name,
|
||||
// const QObject *receiver = NULL,
|
||||
// const char *member = NULL);
|
||||
QAction *action4 = category.addAction(KStandardAction::Quit, QStringLiteral("myownname"));
|
||||
QCOMPARE(action4->objectName(), QStringLiteral("myownname"));
|
||||
QCOMPARE(category.actions().count(action4), 1);
|
||||
QCOMPARE(collection.actions().count(action4), 1);
|
||||
|
||||
// QAction *addAction(
|
||||
// const QString &name,
|
||||
// const QObject *receiver = NULL,
|
||||
// const char *member = NULL);
|
||||
QAction *action5 = category.addAction(QStringLiteral("action5"));
|
||||
QCOMPARE(category.actions().count(action5), 1);
|
||||
QCOMPARE(collection.actions().count(action5), 1);
|
||||
|
||||
// template<class ActionType>
|
||||
// ActionType *add(
|
||||
// const QString &name,
|
||||
// const QObject *receiver = NULL,
|
||||
// const char *member = NULL)
|
||||
KSelectAction *action6 = category.add<KSelectAction>(QStringLiteral("action6"));
|
||||
QCOMPARE(category.actions().count(action6), 1);
|
||||
QCOMPARE(collection.actions().count(action6), 1);
|
||||
|
||||
// There should be 6 actions inside the collection and category
|
||||
QCOMPARE(category.actions().count(), 6);
|
||||
QCOMPARE(collection.actions().count(), 6);
|
||||
delete action1;
|
||||
delete action2;
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_KActionCategory)
|
||||
|
||||
#include "moc_kactioncategorytest.cpp"
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef KACTIONCATEGORYTEST_H
|
||||
#define KACTIONCATEGORYTEST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class tst_KActionCategory : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
// Test the creation of action categories,
|
||||
void tstCreation();
|
||||
|
||||
// Check the synchronization between the action category and the
|
||||
// collection
|
||||
void tstSynchronization();
|
||||
|
||||
// Test the creation of actions
|
||||
void tstActionCreation();
|
||||
|
||||
}; // class tst_KActionCategory
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,341 @@
|
||||
#include "kactioncollectiontest.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QPointer>
|
||||
#include <QSignalSpy>
|
||||
#include <QtTestWidgets>
|
||||
|
||||
#include <KSharedConfig>
|
||||
#include <KStandardActions>
|
||||
|
||||
void tst_KActionCollection::init()
|
||||
{
|
||||
collection = new KActionCollection(static_cast<QObject *>(nullptr));
|
||||
}
|
||||
|
||||
void tst_KActionCollection::cleanup()
|
||||
{
|
||||
delete collection;
|
||||
collection = nullptr;
|
||||
}
|
||||
|
||||
void tst_KActionCollection::clear()
|
||||
{
|
||||
QPointer<QAction> action1 = collection->add<QAction>(QStringLiteral("test1"));
|
||||
QPointer<QAction> action2 = collection->add<QAction>(QStringLiteral("test2"));
|
||||
QPointer<QAction> action3 = collection->add<QAction>(QStringLiteral("test3"));
|
||||
QPointer<QAction> action4 = collection->add<QAction>(QStringLiteral("test4"));
|
||||
QPointer<QAction> action5 = collection->add<QAction>(QStringLiteral("test5"));
|
||||
QPointer<QAction> action6 = collection->add<QAction>(QStringLiteral("test6"));
|
||||
QPointer<QAction> action7 = collection->add<QAction>(QStringLiteral("test7"));
|
||||
|
||||
collection->clear();
|
||||
QVERIFY(collection->isEmpty());
|
||||
|
||||
QVERIFY(action1.isNull());
|
||||
QVERIFY(action2.isNull());
|
||||
QVERIFY(action3.isNull());
|
||||
QVERIFY(action4.isNull());
|
||||
QVERIFY(action5.isNull());
|
||||
QVERIFY(action6.isNull());
|
||||
QVERIFY(action7.isNull());
|
||||
}
|
||||
|
||||
void tst_KActionCollection::addStandardActionFunctorSignal()
|
||||
{
|
||||
bool received = false;
|
||||
QAction *a = collection->addAction(KStandardActions::New, QStringLiteral("test"), this, [&]() {
|
||||
received = true;
|
||||
});
|
||||
a->trigger();
|
||||
QVERIFY(received);
|
||||
delete a;
|
||||
QVERIFY(collection->isEmpty());
|
||||
}
|
||||
|
||||
void tst_KActionCollection::deleted()
|
||||
{
|
||||
// Delete action -> automatically removed from collection
|
||||
QAction *a = collection->add<QAction>(QStringLiteral("test"));
|
||||
delete a;
|
||||
QVERIFY(collection->isEmpty());
|
||||
|
||||
// Delete action's parent -> automatically removed from collection
|
||||
QWidget *myWidget = new QWidget(nullptr);
|
||||
QPointer<QAction> action = new QAction(/*i18n()*/ QStringLiteral("Foo"), myWidget);
|
||||
collection->addAction(QStringLiteral("foo"), action);
|
||||
delete myWidget;
|
||||
QVERIFY(collection->isEmpty());
|
||||
QVERIFY(action.isNull());
|
||||
|
||||
// Delete action's parent, but the action was added to another widget with setAssociatedWidget
|
||||
// and that widget gets deleted first.
|
||||
myWidget = new QWidget(nullptr);
|
||||
QWidget *myAssociatedWidget = new QWidget(myWidget); // child widget
|
||||
action = new QAction(/*i18n()*/ QStringLiteral("Foo"), myWidget); // child action
|
||||
collection->addAction(QStringLiteral("foo"), action);
|
||||
collection->addAssociatedWidget(myAssociatedWidget);
|
||||
QVERIFY(myAssociatedWidget->actions().contains(action));
|
||||
delete myAssociatedWidget; // would be done by the line below, but let's make sure it happens first
|
||||
delete myWidget;
|
||||
QVERIFY(collection->isEmpty());
|
||||
QVERIFY(action.isNull());
|
||||
}
|
||||
|
||||
void tst_KActionCollection::take()
|
||||
{
|
||||
QAction *a = collection->add<QAction>(QStringLiteral("test"));
|
||||
collection->takeAction(a);
|
||||
QVERIFY(collection->isEmpty());
|
||||
delete a;
|
||||
}
|
||||
|
||||
void tst_KActionCollection::writeSettings()
|
||||
{
|
||||
KConfigGroup cfg = clearConfig();
|
||||
|
||||
QList<QKeySequence> defaultShortcut;
|
||||
defaultShortcut << Qt::Key_A << Qt::Key_B;
|
||||
|
||||
QList<QKeySequence> temporaryShortcut;
|
||||
temporaryShortcut << Qt::Key_C << Qt::Key_D;
|
||||
|
||||
QAction *actionWithDifferentShortcut = new QAction(this);
|
||||
KActionCollection::setDefaultShortcuts(actionWithDifferentShortcut, defaultShortcut);
|
||||
actionWithDifferentShortcut->setShortcuts(temporaryShortcut);
|
||||
collection->addAction(QStringLiteral("actionWithDifferentShortcut"), actionWithDifferentShortcut);
|
||||
|
||||
QAction *immutableAction = new QAction(this);
|
||||
KActionCollection::setDefaultShortcuts(immutableAction, defaultShortcut);
|
||||
immutableAction->setShortcuts(temporaryShortcut);
|
||||
KActionCollection::setShortcutsConfigurable(immutableAction, false);
|
||||
collection->addAction(QStringLiteral("immutableAction"), immutableAction);
|
||||
|
||||
QAction *actionWithSameShortcut = new QAction(this);
|
||||
KActionCollection::setDefaultShortcuts(actionWithSameShortcut, defaultShortcut);
|
||||
collection->addAction(QStringLiteral("actionWithSameShortcut"), actionWithSameShortcut);
|
||||
|
||||
cfg.writeEntry("actionToDelete", QStringLiteral("Foobar"));
|
||||
QAction *actionToDelete = new QAction(this);
|
||||
KActionCollection::setDefaultShortcuts(actionToDelete, defaultShortcut);
|
||||
collection->addAction(QStringLiteral("actionToDelete"), actionToDelete);
|
||||
|
||||
collection->writeSettings(&cfg);
|
||||
|
||||
QCOMPARE(cfg.readEntry("actionWithDifferentShortcut", QString()), QKeySequence::listToString(actionWithDifferentShortcut->shortcuts()));
|
||||
QCOMPARE(cfg.readEntry("immutableAction", QString()), QString());
|
||||
QCOMPARE(cfg.readEntry("actionWithSameShortcut", QString()), QString());
|
||||
QCOMPARE(cfg.readEntry("actionToDelete", QString()), QString());
|
||||
|
||||
qDeleteAll(collection->actions());
|
||||
}
|
||||
|
||||
void tst_KActionCollection::readSettings()
|
||||
{
|
||||
KConfigGroup cfg = clearConfig();
|
||||
|
||||
QList<QKeySequence> defaultShortcut;
|
||||
defaultShortcut << Qt::Key_A << Qt::Key_B;
|
||||
|
||||
QList<QKeySequence> temporaryShortcut;
|
||||
temporaryShortcut << Qt::Key_C << Qt::Key_D;
|
||||
|
||||
cfg.writeEntry("normalAction", QKeySequence::listToString(defaultShortcut));
|
||||
cfg.writeEntry("immutable", QKeySequence::listToString(defaultShortcut));
|
||||
cfg.writeEntry("empty", QString());
|
||||
|
||||
QAction *normal = new QAction(this);
|
||||
collection->addAction(QStringLiteral("normalAction"), normal);
|
||||
|
||||
QAction *immutable = new QAction(this);
|
||||
immutable->setShortcuts(temporaryShortcut);
|
||||
KActionCollection::setDefaultShortcuts(immutable, temporaryShortcut);
|
||||
KActionCollection::setShortcutsConfigurable(immutable, false);
|
||||
collection->addAction(QStringLiteral("immutable"), immutable);
|
||||
|
||||
QAction *empty = new QAction(this);
|
||||
collection->addAction(QStringLiteral("empty"), empty);
|
||||
KActionCollection::setDefaultShortcuts(empty, defaultShortcut);
|
||||
empty->setShortcuts(temporaryShortcut);
|
||||
QCOMPARE(QKeySequence::listToString(empty->shortcuts()), QKeySequence::listToString(temporaryShortcut));
|
||||
|
||||
collection->readSettings(&cfg);
|
||||
|
||||
QCOMPARE(QKeySequence::listToString(normal->shortcuts()), QKeySequence::listToString(defaultShortcut));
|
||||
QCOMPARE(QKeySequence::listToString(empty->shortcuts()), QKeySequence::listToString(defaultShortcut));
|
||||
|
||||
QCOMPARE(QKeySequence::listToString(immutable->shortcuts()), QKeySequence::listToString(temporaryShortcut));
|
||||
|
||||
qDeleteAll(collection->actions());
|
||||
}
|
||||
|
||||
void tst_KActionCollection::insertReplaces1()
|
||||
{
|
||||
QAction *a = new QAction(nullptr);
|
||||
QAction *b = new QAction(nullptr);
|
||||
|
||||
collection->addAction(QStringLiteral("a"), a);
|
||||
QVERIFY(collection->actions().contains(a));
|
||||
QVERIFY(collection->action(QStringLiteral("a")) == a);
|
||||
|
||||
collection->addAction(QStringLiteral("a"), b);
|
||||
QVERIFY(!collection->actions().contains(a));
|
||||
QVERIFY(collection->actions().contains(b));
|
||||
QVERIFY(collection->action(QStringLiteral("a")) == b);
|
||||
|
||||
delete a;
|
||||
delete b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that a action added twice under different names only ends up once in
|
||||
* the collection
|
||||
*/
|
||||
void tst_KActionCollection::insertReplaces2()
|
||||
{
|
||||
QAction *a = new QAction(nullptr);
|
||||
|
||||
collection->addAction(QStringLiteral("a"), a);
|
||||
QVERIFY(collection->actions().contains(a));
|
||||
QVERIFY(collection->action(QStringLiteral("a")) == a);
|
||||
|
||||
// Simple test: Just add it twice
|
||||
collection->addAction(QStringLiteral("b"), a);
|
||||
QVERIFY(collection->actions().contains(a));
|
||||
QVERIFY(!collection->action(QStringLiteral("a")));
|
||||
QVERIFY(collection->action(QStringLiteral("b")) == a);
|
||||
|
||||
// Complex text: Mesh with the objectname
|
||||
a->setObjectName(QStringLiteral("c"));
|
||||
collection->addAction(QStringLiteral("d"), a);
|
||||
QVERIFY(collection->actions().contains(a));
|
||||
QVERIFY(!collection->action(QStringLiteral("b")));
|
||||
QVERIFY(!collection->action(QStringLiteral("c")));
|
||||
QVERIFY(collection->action(QStringLiteral("d")) == a);
|
||||
|
||||
delete a;
|
||||
}
|
||||
|
||||
KConfigGroup tst_KActionCollection::clearConfig()
|
||||
{
|
||||
KSharedConfig::Ptr cfg = KSharedConfig::openConfig();
|
||||
cfg->deleteGroup(collection->configGroup());
|
||||
return KConfigGroup(cfg, collection->configGroup());
|
||||
}
|
||||
|
||||
void tst_KActionCollection::testSetShortcuts()
|
||||
{
|
||||
QAction *action = new QAction(/*i18n*/ (QStringLiteral("Next Unread &Folder")), this);
|
||||
collection->addAction(QStringLiteral("go_next_unread_folder"), action);
|
||||
KActionCollection::setDefaultShortcut(action, QKeySequence(Qt::ALT | Qt::Key_Plus));
|
||||
QList<QKeySequence> shortcut = action->shortcuts();
|
||||
shortcut << QKeySequence(Qt::CTRL | Qt::Key_Plus);
|
||||
action->setShortcuts(shortcut);
|
||||
QCOMPARE(QKeySequence::listToString(action->shortcuts()), QStringLiteral("Alt++; Ctrl++"));
|
||||
|
||||
// Simpler way:
|
||||
QList<QKeySequence> shortcut2;
|
||||
shortcut2 << QKeySequence(Qt::ALT | Qt::Key_Plus) << QKeySequence(Qt::CTRL | Qt::Key_Plus);
|
||||
QCOMPARE(QKeySequence::listToString(shortcut2), QStringLiteral("Alt++; Ctrl++"));
|
||||
}
|
||||
|
||||
void tst_KActionCollection::implicitStandardActionInsertionUsingCreate()
|
||||
{
|
||||
KActionCollection collection(static_cast<QObject *>(nullptr));
|
||||
QAction *a = KStandardActions::create(KStandardActions::Undo, qApp, &QCoreApplication::quit, &collection);
|
||||
QVERIFY(a);
|
||||
|
||||
QVERIFY(a->parent() == &collection);
|
||||
QVERIFY(collection.action(KStandardActions::name(KStandardActions::Undo)) == a);
|
||||
}
|
||||
|
||||
void tst_KActionCollection::implicitStandardActionInsertionUsingCut()
|
||||
{
|
||||
KActionCollection collection(static_cast<QObject *>(nullptr));
|
||||
QAction *cut = KStandardAction::cut(&collection);
|
||||
QAction *a = collection.action(KStandardActions::name(KStandardActions::Cut));
|
||||
QVERIFY(a);
|
||||
QVERIFY(a == cut);
|
||||
}
|
||||
|
||||
void tst_KActionCollection::shouldEmitSignals()
|
||||
{
|
||||
QAction *a = new QAction(nullptr);
|
||||
QAction *b = new QAction(nullptr);
|
||||
|
||||
QSignalSpy insertedSpy(collection, &KActionCollection::inserted);
|
||||
QSignalSpy changedSpy(collection, &KActionCollection::changed);
|
||||
|
||||
// Insert "first"
|
||||
collection->addAction(QStringLiteral("first"), a);
|
||||
QVERIFY(collection->actions().contains(a));
|
||||
QCOMPARE(insertedSpy.count(), 1);
|
||||
QCOMPARE(insertedSpy.at(0).at(0).value<QAction *>(), a);
|
||||
QCOMPARE(changedSpy.count(), 1);
|
||||
insertedSpy.clear();
|
||||
changedSpy.clear();
|
||||
|
||||
// Replace "first"
|
||||
collection->addAction(QStringLiteral("first"), b);
|
||||
QVERIFY(!collection->actions().contains(a));
|
||||
QVERIFY(collection->actions().contains(b));
|
||||
QCOMPARE(insertedSpy.count(), 1);
|
||||
QCOMPARE(insertedSpy.at(0).at(0).value<QAction *>(), b);
|
||||
QCOMPARE(changedSpy.count(), 2); // once for removing a, once for inserting b
|
||||
insertedSpy.clear();
|
||||
changedSpy.clear();
|
||||
|
||||
// Insert "second"
|
||||
collection->addAction(QStringLiteral("second"), a);
|
||||
QCOMPARE(insertedSpy.count(), 1);
|
||||
QCOMPARE(insertedSpy.at(0).at(0).value<QAction *>(), a);
|
||||
QCOMPARE(changedSpy.count(), 1);
|
||||
insertedSpy.clear();
|
||||
changedSpy.clear();
|
||||
|
||||
// Remove and delete "second" (which is a)
|
||||
collection->removeAction(a);
|
||||
QCOMPARE(changedSpy.count(), 1);
|
||||
changedSpy.clear();
|
||||
|
||||
// Delete b directly, should automatically remove it from the collection and emit changed
|
||||
delete b;
|
||||
QCOMPARE(changedSpy.count(), 1);
|
||||
changedSpy.clear();
|
||||
}
|
||||
|
||||
void tst_KActionCollection::testActionsAreInInsertionOrder()
|
||||
{
|
||||
collection->clear();
|
||||
|
||||
QAction *a = new QAction(nullptr);
|
||||
QAction *b = new QAction(nullptr);
|
||||
QAction *c = new QAction(nullptr);
|
||||
|
||||
collection->addAction(QStringLiteral("b"), b);
|
||||
collection->addAction(QStringLiteral("a"), a);
|
||||
collection->addAction(QStringLiteral("c"), c);
|
||||
|
||||
QList<QAction *> expected{b, a, c};
|
||||
QCOMPARE(collection->actions(), expected);
|
||||
collection->clear();
|
||||
}
|
||||
|
||||
void tst_KActionCollection::testActionForName()
|
||||
{
|
||||
QAction *a = new QAction(nullptr);
|
||||
QAction *b = new QAction(nullptr);
|
||||
QAction *c = new QAction(nullptr);
|
||||
|
||||
collection->addAction(QStringLiteral("ba"), b);
|
||||
collection->addAction(QStringLiteral("ae"), a);
|
||||
collection->addAction(QStringLiteral("cf"), c);
|
||||
|
||||
QCOMPARE(collection->action(QStringLiteral("ba")), b);
|
||||
QCOMPARE(collection->action(QStringLiteral("cf")), c);
|
||||
QCOMPARE(collection->action(QStringLiteral("ae")), a);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_KActionCollection)
|
||||
|
||||
#include "moc_kactioncollectiontest.cpp"
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef KACTIONCOLLECTIONTEST_H
|
||||
#define KACTIONCOLLECTIONTEST_H
|
||||
|
||||
#include "kactioncollection.h"
|
||||
#include <KConfigGroup>
|
||||
|
||||
class tst_KActionCollection : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public Q_SLOTS:
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
private Q_SLOTS:
|
||||
void clear();
|
||||
void deleted();
|
||||
void take();
|
||||
void writeSettings();
|
||||
void readSettings();
|
||||
void insertReplaces1();
|
||||
void insertReplaces2();
|
||||
void testSetShortcuts();
|
||||
void implicitStandardActionInsertionUsingCreate();
|
||||
void implicitStandardActionInsertionUsingCut();
|
||||
void shouldEmitSignals();
|
||||
void addStandardActionFunctorSignal();
|
||||
void testActionsAreInInsertionOrder();
|
||||
void testActionForName();
|
||||
|
||||
private:
|
||||
KConfigGroup clearConfig();
|
||||
|
||||
KActionCollection *collection;
|
||||
};
|
||||
|
||||
#endif // KACTIONCOLLECTIONTEST_H
|
||||
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2006 David Faure <faure@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kmainwindow_unittest.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KSharedConfig>
|
||||
#include <QEventLoopLocker>
|
||||
#include <QResizeEvent>
|
||||
#include <QStatusBar>
|
||||
#include <QTest>
|
||||
#include <QTimer>
|
||||
#include <kmainwindow.h>
|
||||
#include <ktoolbar.h>
|
||||
|
||||
QTEST_MAIN(KMainWindow_UnitTest)
|
||||
|
||||
void KMainWindow_UnitTest::initTestCase()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
QFile::remove(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + KSharedConfig::openConfig()->name());
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::cleanupTestCase()
|
||||
{
|
||||
QFile::remove(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + KSharedConfig::openConfig()->name());
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testDefaultName()
|
||||
{
|
||||
KMainWindow mw;
|
||||
mw.show();
|
||||
mw.ensurePolished();
|
||||
QCOMPARE(mw.objectName(), QStringLiteral("MainWindow#1"));
|
||||
KMainWindow mw2;
|
||||
mw2.show();
|
||||
mw2.ensurePolished();
|
||||
QCOMPARE(mw2.objectName(), QStringLiteral("MainWindow#2"));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testFixedName()
|
||||
{
|
||||
KMainWindow mw;
|
||||
mw.setObjectName(QStringLiteral("mymainwindow"));
|
||||
mw.show();
|
||||
mw.ensurePolished();
|
||||
QCOMPARE(mw.objectName(), QStringLiteral("mymainwindow"));
|
||||
KMainWindow mw2;
|
||||
mw2.setObjectName(QStringLiteral("mymainwindow"));
|
||||
mw2.show();
|
||||
mw2.ensurePolished();
|
||||
QCOMPARE(mw2.objectName(), QStringLiteral("mymainwindow2"));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testNameWithHash()
|
||||
{
|
||||
KMainWindow mw;
|
||||
mw.setObjectName(QStringLiteral("composer#"));
|
||||
mw.show();
|
||||
mw.ensurePolished();
|
||||
QCOMPARE(mw.objectName(), QStringLiteral("composer#1"));
|
||||
KMainWindow mw2;
|
||||
mw2.setObjectName(QStringLiteral("composer#"));
|
||||
mw2.show();
|
||||
mw2.ensurePolished();
|
||||
QCOMPARE(mw2.objectName(), QStringLiteral("composer#2"));
|
||||
KMainWindow mw4;
|
||||
mw4.setObjectName(QStringLiteral("composer#4"));
|
||||
mw4.show();
|
||||
mw4.ensurePolished();
|
||||
QCOMPARE(mw4.objectName(), QStringLiteral("composer#4"));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testNameWithSpecialChars()
|
||||
{
|
||||
KMainWindow mw;
|
||||
mw.setObjectName(QStringLiteral("a#@_test/"));
|
||||
mw.show();
|
||||
mw.ensurePolished();
|
||||
QCOMPARE(mw.dbusName(), QStringLiteral("/kmainwindow_unittest/a___test_"));
|
||||
KMainWindow mw2;
|
||||
mw2.setObjectName(QStringLiteral("a#@_test/"));
|
||||
mw2.show();
|
||||
mw2.ensurePolished();
|
||||
QCOMPARE(mw2.dbusName(), QStringLiteral("/kmainwindow_unittest/a___test_2"));
|
||||
}
|
||||
|
||||
static bool s_mainWindowDeleted;
|
||||
class MyMainWindow : public KMainWindow
|
||||
{
|
||||
public:
|
||||
MyMainWindow()
|
||||
: KMainWindow()
|
||||
, m_queryClosedCalled(false)
|
||||
{
|
||||
}
|
||||
bool queryClose() override
|
||||
{
|
||||
m_queryClosedCalled = true;
|
||||
return true;
|
||||
}
|
||||
~MyMainWindow() override
|
||||
{
|
||||
s_mainWindowDeleted = true;
|
||||
}
|
||||
bool m_queryClosedCalled;
|
||||
|
||||
void reallyResize(int width, int height)
|
||||
{
|
||||
const QSize oldSize = size();
|
||||
|
||||
resize(width, height);
|
||||
|
||||
// Send the pending resize event (resize() only sets Qt::WA_PendingResizeEvent)
|
||||
QResizeEvent e(size(), oldSize);
|
||||
QApplication::sendEvent(this, &e);
|
||||
|
||||
QCOMPARE(this->width(), width);
|
||||
QCOMPARE(this->height(), height);
|
||||
}
|
||||
};
|
||||
|
||||
// Here we test
|
||||
// - that queryClose is called
|
||||
// - that autodeletion happens
|
||||
void KMainWindow_UnitTest::testDeleteOnClose()
|
||||
{
|
||||
QEventLoopLocker locker; // don't let the deref in KMainWindow quit the app.
|
||||
s_mainWindowDeleted = false;
|
||||
MyMainWindow *mw = new MyMainWindow;
|
||||
QVERIFY(mw->testAttribute(Qt::WA_DeleteOnClose));
|
||||
mw->close();
|
||||
QVERIFY(mw->m_queryClosedCalled);
|
||||
qApp->sendPostedEvents(mw, QEvent::DeferredDelete);
|
||||
QVERIFY(s_mainWindowDeleted);
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testSaveWindowSize()
|
||||
{
|
||||
QCOMPARE(KSharedConfig::openConfig()->name(), QStringLiteral("kmainwindow_unittestrc"));
|
||||
KConfigGroup cfg(KSharedConfig::openConfig(), QStringLiteral("TestWindowSize"));
|
||||
|
||||
{
|
||||
MyMainWindow mw;
|
||||
mw.show();
|
||||
KToolBar *tb = new KToolBar(&mw); // we need a toolbar to trigger an old bug in saveMainWindowSettings
|
||||
tb->setObjectName(QStringLiteral("testtb"));
|
||||
mw.reallyResize(800, 600);
|
||||
QTRY_COMPARE(mw.size(), QSize(800, 600));
|
||||
QTRY_COMPARE(mw.windowHandle()->size(), QSize(800, 600));
|
||||
mw.saveMainWindowSettings(cfg);
|
||||
mw.close();
|
||||
}
|
||||
|
||||
KMainWindow mw2;
|
||||
mw2.show();
|
||||
KToolBar *tb = new KToolBar(&mw2);
|
||||
tb->setObjectName(QStringLiteral("testtb"));
|
||||
mw2.resize(500, 500);
|
||||
mw2.applyMainWindowSettings(cfg);
|
||||
|
||||
QTRY_COMPARE(mw2.size(), QSize(800, 600));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testSaveWindowSizeInStateConfig()
|
||||
{
|
||||
QCOMPARE(KSharedConfig::openConfig()->name(), QStringLiteral("kmainwindow_unittestrc"));
|
||||
KConfigGroup cfg(KSharedConfig::openConfig(), QStringLiteral("testSaveWindowSizeInStateConfig"));
|
||||
cfg.deleteGroup();
|
||||
QVERIFY(cfg.isValid());
|
||||
|
||||
{
|
||||
MyMainWindow mw;
|
||||
mw.show();
|
||||
mw.reallyResize(800, 600);
|
||||
mw.setStateConfigGroup(QStringLiteral("StateConfigGroup"));
|
||||
mw.saveMainWindowSettings(cfg);
|
||||
mw.close();
|
||||
}
|
||||
|
||||
const KConfigGroup stateGrp = KSharedConfig::openStateConfig()->group(QStringLiteral("StateConfigGroup"));
|
||||
QVERIFY(stateGrp.exists());
|
||||
QVERIFY(stateGrp.hasKey("State"));
|
||||
QVERIFY(!cfg.hasKey("State"));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testAutoSaveSettings()
|
||||
{
|
||||
const QString group(QStringLiteral("AutoSaveTestGroup"));
|
||||
|
||||
{
|
||||
MyMainWindow mw;
|
||||
mw.show();
|
||||
KToolBar *tb = new KToolBar(&mw); // we need a toolbar to trigger an old bug in saveMainWindowSettings
|
||||
tb->setObjectName(QStringLiteral("testtb"));
|
||||
mw.setStateConfigGroup(group);
|
||||
mw.setAutoSaveSettings(group);
|
||||
mw.reallyResize(800, 600);
|
||||
QVERIFY(mw.autoSaveSettings());
|
||||
|
||||
// Ensure we save the settings in the correct place
|
||||
const auto hasWidthAndHightSaved = [](const QStringList &keys) {
|
||||
const auto containsKey = [&keys](const QLatin1String &keyToCheck) {
|
||||
return std::any_of(keys.begin(), keys.end(), [&keyToCheck](const QString &key) {
|
||||
return key.contains(keyToCheck);
|
||||
});
|
||||
};
|
||||
return containsKey(QLatin1String("Width")) && containsKey(QLatin1String("Height"));
|
||||
};
|
||||
QTRY_VERIFY(hasWidthAndHightSaved(mw.stateConfigGroup().keyList()));
|
||||
QTRY_VERIFY(!hasWidthAndHightSaved(mw.autoSaveConfigGroup().keyList()));
|
||||
mw.close();
|
||||
}
|
||||
|
||||
KMainWindow mw2;
|
||||
mw2.show();
|
||||
KToolBar *tb = new KToolBar(&mw2);
|
||||
tb->setObjectName(QStringLiteral("testtb"));
|
||||
mw2.setStateConfigGroup(group);
|
||||
mw2.setAutoSaveSettings(group);
|
||||
QTRY_COMPARE(mw2.size(), QSize(800, 600));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testNoAutoSave()
|
||||
{
|
||||
const QString group(QStringLiteral("AutoSaveTestGroup"));
|
||||
|
||||
{
|
||||
// A mainwindow with autosaving, but not of the window size.
|
||||
MyMainWindow mw;
|
||||
mw.show();
|
||||
mw.setStateConfigGroup(group);
|
||||
mw.setAutoSaveSettings(group, false);
|
||||
mw.reallyResize(750, 550);
|
||||
mw.close();
|
||||
}
|
||||
|
||||
KMainWindow mw2;
|
||||
mw2.show();
|
||||
mw2.setStateConfigGroup(group);
|
||||
mw2.setAutoSaveSettings(group, false);
|
||||
// NOT 750, 550! (the 800,600 comes from testAutoSaveSettings)
|
||||
QTRY_COMPARE(mw2.size(), QSize(800, 600));
|
||||
}
|
||||
|
||||
void KMainWindow_UnitTest::testWidgetWithStatusBar()
|
||||
{
|
||||
// KMainWindow::statusBar() should not find any indirect QStatusBar child
|
||||
// (e.g. in a case like konqueror, with one statusbar per frame)
|
||||
MyMainWindow mw;
|
||||
QWidget *frame1 = new QWidget(&mw);
|
||||
QStatusBar *frameStatusBar = new QStatusBar(frame1);
|
||||
QVERIFY(mw.statusBar() != frameStatusBar);
|
||||
}
|
||||
|
||||
#include "moc_kmainwindow_unittest.cpp"
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2006 David Faure <faure@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef KMAINWINDOW_UNITTEST_H
|
||||
#define KMAINWINDOW_UNITTEST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class KMainWindow_UnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testDefaultName();
|
||||
void testFixedName();
|
||||
void testNameWithSpecialChars();
|
||||
void testNameWithHash();
|
||||
void testSaveWindowSize();
|
||||
void testSaveWindowSizeInStateConfig();
|
||||
void testAutoSaveSettings();
|
||||
void testNoAutoSave();
|
||||
void testWidgetWithStatusBar();
|
||||
|
||||
void testDeleteOnClose();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,591 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include "testguiclient.h"
|
||||
#include "testxmlguiwindow.h"
|
||||
|
||||
#ifdef WITH_QTDBUS
|
||||
#include <QDBusConnection>
|
||||
#endif
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QSignalSpy>
|
||||
#include <QStandardPaths>
|
||||
#include <QTest>
|
||||
|
||||
#include <KConfig>
|
||||
#include <KConfigGroup>
|
||||
#include <KIconLoader>
|
||||
#include <KSharedConfig>
|
||||
#include <kmainwindow.h>
|
||||
#include <ktoolbar.h>
|
||||
|
||||
// We use the data types below in a QVariant, so Q_DECLARE_METATYPE is needed for them.
|
||||
Q_DECLARE_METATYPE(Qt::MouseButton)
|
||||
Q_DECLARE_METATYPE(Qt::MouseButtons)
|
||||
Q_DECLARE_METATYPE(Qt::KeyboardModifiers)
|
||||
|
||||
// Ensure everything uses test paths, including stuff run before main, such as the KdePlatformThemePlugin
|
||||
void enableTestMode()
|
||||
{
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
}
|
||||
Q_CONSTRUCTOR_FUNCTION(enableTestMode)
|
||||
|
||||
class tst_KToolBar : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
private Q_SLOTS:
|
||||
void ktoolbar();
|
||||
|
||||
void testIconSizeNoXmlGui_data();
|
||||
void testIconSizeNoXmlGui();
|
||||
void testIconSizeXmlGui_data();
|
||||
void testIconSizeXmlGui();
|
||||
void testToolButtonStyleNoXmlGui_data();
|
||||
void testToolButtonStyleNoXmlGui();
|
||||
void testToolButtonStyleXmlGui_data();
|
||||
void testToolButtonStyleXmlGui();
|
||||
void testToolBarPosition();
|
||||
void testXmlGuiSwitching();
|
||||
void testKAuthorizedDisableToggleAction();
|
||||
|
||||
Q_SIGNALS:
|
||||
void signalAppearanceChanged();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void changeGlobalToolButtonStyleSetting(const QString &, const QString &);
|
||||
void deleteGlobalToolButtonStyleSetting();
|
||||
QByteArray m_xml;
|
||||
bool m_showWasCalled;
|
||||
};
|
||||
|
||||
QTEST_MAIN(tst_KToolBar)
|
||||
|
||||
static void copy_dir(const QString &from, const QDir &to)
|
||||
{
|
||||
QDir src = QDir(from);
|
||||
QDir dest = QDir(to.filePath(src.dirName()));
|
||||
to.mkpath(src.dirName());
|
||||
const auto fileInfos = src.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
for (const QFileInfo &fileInfo : fileInfos) {
|
||||
if (fileInfo.isDir()) {
|
||||
copy_dir(fileInfo.filePath(), dest);
|
||||
} else {
|
||||
QFile::copy(fileInfo.filePath(), dest.filePath(fileInfo.fileName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This will be called before the first test function is executed.
|
||||
// It is only called once.
|
||||
void tst_KToolBar::initTestCase()
|
||||
{
|
||||
// start with a clean place to put data
|
||||
QDir testDataDir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QVERIFY(testDataDir.absolutePath().contains(QLatin1String("qttest")));
|
||||
testDataDir.removeRecursively();
|
||||
testDataDir.mkpath(QStringLiteral("."));
|
||||
|
||||
// setup action restriction so we can test whether this actually disables some functionality
|
||||
KConfigGroup actionRestrictions(KSharedConfig::openConfig(), QStringLiteral("KDE Action Restrictions"));
|
||||
actionRestrictions.writeEntry("action/options_show_toolbar", false);
|
||||
|
||||
// copy a minimal icon theme to where KIconTheme will find it, in case oxygen-icons is not
|
||||
// installed
|
||||
copy_dir(QFINDTESTDATA("icons"), testDataDir);
|
||||
|
||||
m_xml =
|
||||
"<?xml version = '1.0'?>\n"
|
||||
"<!DOCTYPE gui SYSTEM \"kpartgui.dtd\">\n"
|
||||
"<gui version=\"1\" name=\"foo\" >\n"
|
||||
"<MenuBar>\n"
|
||||
"</MenuBar>\n"
|
||||
"<ToolBar name=\"mainToolBar\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"<ToolBar name=\"otherToolBar\" position=\"bottom\" iconText=\"TextUnderIcon\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"<ToolBar name=\"cleanToolBar\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"<ToolBar name=\"hiddenToolBar\" hidden=\"true\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"<ToolBar name=\"secondHiddenToolBar\" hidden=\"true\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"<ToolBar iconSize=\"32\" name=\"bigToolBar\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"<ToolBar iconSize=\"32\" name=\"bigUnchangedToolBar\">\n"
|
||||
" <Action name=\"go_up\"/>\n"
|
||||
"</ToolBar>\n"
|
||||
"</gui>\n";
|
||||
|
||||
qRegisterMetaType<Qt::MouseButtons>("Qt::MouseButtons");
|
||||
qRegisterMetaType<Qt::KeyboardModifiers>("Qt::KeyboardModifiers");
|
||||
}
|
||||
|
||||
// This will be called after the last test function is executed.
|
||||
// It is only called once.
|
||||
void tst_KToolBar::cleanupTestCase()
|
||||
{
|
||||
QDir testDataDir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir testIconsDir = QDir(testDataDir.absoluteFilePath(QStringLiteral("icons")));
|
||||
QVERIFY(testIconsDir.absolutePath().contains(QLatin1String("qttest")));
|
||||
testIconsDir.removeRecursively();
|
||||
}
|
||||
|
||||
// This will be called before each test function is executed.
|
||||
void tst_KToolBar::init()
|
||||
{
|
||||
}
|
||||
|
||||
// This will be called after every test function.
|
||||
void tst_KToolBar::cleanup()
|
||||
{
|
||||
QFile::remove(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QStringLiteral("/tst_KToolBar"));
|
||||
deleteGlobalToolButtonStyleSetting();
|
||||
}
|
||||
|
||||
void tst_KToolBar::ktoolbar()
|
||||
{
|
||||
KMainWindow kmw;
|
||||
// Creating a KToolBar directly
|
||||
KToolBar bar(&kmw);
|
||||
QCOMPARE(bar.mainWindow(), &kmw);
|
||||
// Asking KMainWindow for a KToolBar (more common)
|
||||
KToolBar *mainToolBar = kmw.toolBar(QStringLiteral("mainToolBar"));
|
||||
QCOMPARE(mainToolBar->mainWindow(), &kmw);
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KConfigGroup)
|
||||
|
||||
void tst_KToolBar::testIconSizeNoXmlGui_data()
|
||||
{
|
||||
QTest::addColumn<int>("iconSize");
|
||||
QTest::newRow("16") << 16;
|
||||
QTest::newRow("22") << 22;
|
||||
QTest::newRow("32") << 32;
|
||||
QTest::newRow("64") << 64;
|
||||
}
|
||||
|
||||
void tst_KToolBar::testIconSizeNoXmlGui()
|
||||
{
|
||||
QFETCH(int, iconSize);
|
||||
KConfig config(QStringLiteral("tst_KToolBar"));
|
||||
KConfigGroup group(&config, QStringLiteral("group"));
|
||||
{
|
||||
KMainWindow kmw;
|
||||
KToolBar *mainToolBar = kmw.toolBar(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBar(QStringLiteral("otherToolBar"));
|
||||
|
||||
// Default settings (applied by applyAppearanceSettings)
|
||||
QCOMPARE(mainToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::MainToolbar));
|
||||
QCOMPARE(otherToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::Toolbar));
|
||||
// check the actual values - update this if kicontheme's defaults are changed
|
||||
QCOMPARE(KIconLoader::global()->currentSize(KIconLoader::MainToolbar), 22);
|
||||
QCOMPARE(KIconLoader::global()->currentSize(KIconLoader::Toolbar), 22);
|
||||
|
||||
// Changing settings for a given toolbar, as user
|
||||
mainToolBar->setIconDimensions(iconSize);
|
||||
otherToolBar->setIconDimensions(iconSize);
|
||||
|
||||
// Save settings
|
||||
kmw.saveMainWindowSettings(group);
|
||||
// was it the default value?
|
||||
if (iconSize == KIconLoader::global()->currentSize(KIconLoader::MainToolbar)) {
|
||||
QCOMPARE(group.groupList().count(), 0); // nothing to save
|
||||
QVERIFY(!group.group(QStringLiteral("Toolbar mainToolBar")).hasKey("IconSize"));
|
||||
} else {
|
||||
QCOMPARE(group.groupList().count(), 2); // two subgroups (one for each toolbar)
|
||||
QVERIFY(group.group(QStringLiteral("Toolbar mainToolBar")).hasKey("IconSize"));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Recreate, load, compare.
|
||||
KMainWindow kmw;
|
||||
KToolBar *mainToolBar = kmw.toolBar(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBar(QStringLiteral("otherToolBar"));
|
||||
KToolBar *cleanToolBar = kmw.toolBar(QStringLiteral("cleanToolBar"));
|
||||
QCOMPARE(mainToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::MainToolbar));
|
||||
QCOMPARE(otherToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::Toolbar));
|
||||
QCOMPARE(cleanToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::Toolbar));
|
||||
kmw.applyMainWindowSettings(group);
|
||||
QCOMPARE(mainToolBar->iconSize().width(), iconSize);
|
||||
QCOMPARE(otherToolBar->iconSize().width(), iconSize);
|
||||
QCOMPARE(cleanToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::Toolbar)); // unchanged
|
||||
}
|
||||
}
|
||||
|
||||
void tst_KToolBar::testIconSizeXmlGui_data()
|
||||
{
|
||||
QTest::addColumn<int>("iconSize"); // set by user and saved to KConfig
|
||||
// When the user chose a specific size for the toolbar (!= its default size), the new kde-global size isn't applied to that toolbar.
|
||||
// So, only in case the toolbar was at iconSize already, and there was no setting in xml, we end up with kdeGlobal being used:
|
||||
QTest::newRow("16") << 16;
|
||||
QTest::newRow("22") << 22;
|
||||
QTest::newRow("32") << 32;
|
||||
QTest::newRow("64") << 64;
|
||||
}
|
||||
|
||||
void tst_KToolBar::testIconSizeXmlGui()
|
||||
{
|
||||
QFETCH(int, iconSize);
|
||||
KConfig config(QStringLiteral("tst_KToolBar"));
|
||||
KConfigGroup group(&config, QStringLiteral("group"));
|
||||
{
|
||||
TestXmlGuiWindow kmw(m_xml, "tst_ktoolbar.rc");
|
||||
kmw.createActions(QStringList() << QStringLiteral("go_up"));
|
||||
kmw.createGUI();
|
||||
KToolBar *mainToolBar = kmw.toolBarByName(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBarByName(QStringLiteral("otherToolBar"));
|
||||
KToolBar *cleanToolBar = kmw.toolBarByName(QStringLiteral("cleanToolBar"));
|
||||
KToolBar *bigToolBar = kmw.toolBarByName(QStringLiteral("bigToolBar"));
|
||||
KToolBar *bigUnchangedToolBar = kmw.toolBarByName(QStringLiteral("bigUnchangedToolBar"));
|
||||
|
||||
// Default settings (applied by applyAppearanceSettings)
|
||||
QCOMPARE(mainToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::MainToolbar));
|
||||
QCOMPARE(otherToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::Toolbar));
|
||||
// check the actual values - update this if kicontheme's defaults are changed
|
||||
QCOMPARE(mainToolBar->iconSize().width(), 22);
|
||||
QCOMPARE(otherToolBar->iconSize().width(), 22);
|
||||
QCOMPARE(cleanToolBar->iconSize().width(), 22);
|
||||
QCOMPARE(bigToolBar->iconSize().width(), 32);
|
||||
QCOMPARE(bigUnchangedToolBar->iconSize().width(), 32);
|
||||
|
||||
// Changing settings for a given toolbar, as user (to test the initial report in #168480)
|
||||
mainToolBar->setIconDimensions(iconSize);
|
||||
otherToolBar->setIconDimensions(iconSize);
|
||||
bigToolBar->setIconDimensions(iconSize);
|
||||
|
||||
// Save settings
|
||||
kmw.saveMainWindowSettings(group);
|
||||
// was it the default size? (for the main toolbar, we only check that one)
|
||||
const bool usingDefaultSize = iconSize == KIconLoader::global()->currentSize(KIconLoader::MainToolbar);
|
||||
if (usingDefaultSize) {
|
||||
QVERIFY(!group.groupList().contains(QLatin1String("Toolbar mainToolBar")));
|
||||
QVERIFY(!group.group(QStringLiteral("Toolbar mainToolBar")).hasKey("IconSize"));
|
||||
} else {
|
||||
QVERIFY(group.group(QStringLiteral("Toolbar mainToolBar")).hasKey("IconSize"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::ToolButtonStyle)
|
||||
|
||||
void tst_KToolBar::testToolButtonStyleNoXmlGui_data()
|
||||
{
|
||||
QTest::addColumn<Qt::ToolButtonStyle>("toolButtonStyle");
|
||||
QTest::newRow("Qt::ToolButtonIconOnly") << Qt::ToolButtonIconOnly;
|
||||
QTest::newRow("Qt::ToolButtonTextOnly") << Qt::ToolButtonTextOnly;
|
||||
QTest::newRow("Qt::ToolButtonTextBesideIcon") << Qt::ToolButtonTextBesideIcon;
|
||||
QTest::newRow("Qt::ToolButtonTextUnderIcon") << Qt::ToolButtonTextUnderIcon;
|
||||
}
|
||||
|
||||
void tst_KToolBar::testToolButtonStyleNoXmlGui()
|
||||
{
|
||||
QFETCH(Qt::ToolButtonStyle, toolButtonStyle);
|
||||
const Qt::ToolButtonStyle mainToolBarDefaultStyle = Qt::ToolButtonTextBesideIcon; // was TextUnderIcon before KDE-4.4.0
|
||||
const bool selectedDefaultForMainToolbar = toolButtonStyle == mainToolBarDefaultStyle;
|
||||
const bool selectedDefaultForOtherToolbar = toolButtonStyle == Qt::ToolButtonTextBesideIcon;
|
||||
|
||||
KConfig config(QStringLiteral("tst_KToolBar"));
|
||||
KConfigGroup group(&config, QStringLiteral("group"));
|
||||
{
|
||||
KMainWindow kmw;
|
||||
KToolBar *mainToolBar = kmw.toolBar(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBar(QStringLiteral("otherToolBar"));
|
||||
|
||||
// Default settings (applied by applyAppearanceSettings)
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)mainToolBarDefaultStyle);
|
||||
QCOMPARE((int)otherToolBar->toolButtonStyle(), (int)Qt::ToolButtonTextBesideIcon); // see r883541
|
||||
QCOMPARE(kmw.toolBarArea(mainToolBar), Qt::TopToolBarArea);
|
||||
|
||||
// Changing settings for a given toolbar, as user
|
||||
mainToolBar->setToolButtonStyle(toolButtonStyle);
|
||||
otherToolBar->setToolButtonStyle(toolButtonStyle);
|
||||
|
||||
// Save settings
|
||||
kmw.saveMainWindowSettings(group);
|
||||
if (selectedDefaultForMainToolbar) {
|
||||
QCOMPARE(group.groupList().count(), 0); // nothing to save
|
||||
QVERIFY(!group.group(QStringLiteral("Toolbar mainToolBar")).hasKey("ToolButtonStyle"));
|
||||
} else {
|
||||
QCOMPARE(group.groupList().count(), 2); // two subgroups (one for each toolbar)
|
||||
QVERIFY(group.group(QStringLiteral("Toolbar mainToolBar")).hasKey("ToolButtonStyle"));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Recreate, load, compare.
|
||||
KMainWindow kmw;
|
||||
KToolBar *mainToolBar = kmw.toolBar(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBar(QStringLiteral("otherToolBar"));
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)mainToolBarDefaultStyle);
|
||||
kmw.applyMainWindowSettings(group);
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)toolButtonStyle);
|
||||
QCOMPARE((int)otherToolBar->toolButtonStyle(), (int)toolButtonStyle);
|
||||
|
||||
#ifdef WITH_QTDBUS // the change notification uses DBus
|
||||
// Now change KDE-global setting
|
||||
changeGlobalToolButtonStyleSetting(QStringLiteral("IconOnly"), QStringLiteral("TextOnly"));
|
||||
|
||||
if (selectedDefaultForMainToolbar) {
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)Qt::ToolButtonIconOnly);
|
||||
} else {
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)toolButtonStyle);
|
||||
}
|
||||
|
||||
if (selectedDefaultForOtherToolbar) {
|
||||
QCOMPARE((int)otherToolBar->toolButtonStyle(), (int)Qt::ToolButtonTextOnly);
|
||||
} else {
|
||||
QCOMPARE((int)otherToolBar->toolButtonStyle(), (int)toolButtonStyle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void tst_KToolBar::testToolButtonStyleXmlGui_data()
|
||||
{
|
||||
QTest::addColumn<Qt::ToolButtonStyle>("toolButtonStyle");
|
||||
// Expected style after KDE-global is changed to main=IconOnly/other=TextOnly
|
||||
QTest::addColumn<Qt::ToolButtonStyle>("expectedStyleMainToolbar");
|
||||
QTest::addColumn<Qt::ToolButtonStyle>("expectedStyleOtherToolbar"); // xml says text-under-icons, user-selected should always win
|
||||
QTest::addColumn<Qt::ToolButtonStyle>("expectedStyleCleanToolbar"); // should always follow kde-global -> always textonly.
|
||||
|
||||
QTest::newRow("Qt::ToolButtonTextUnderIcon") << Qt::ToolButtonTextUnderIcon << Qt::ToolButtonTextUnderIcon << Qt::ToolButtonTextUnderIcon
|
||||
<< Qt::ToolButtonTextOnly;
|
||||
QTest::newRow("Qt::ToolButtonTextBesideIcon") << Qt::ToolButtonTextBesideIcon
|
||||
<< Qt::ToolButtonIconOnly /* was default -> using kde global */ << Qt::ToolButtonTextBesideIcon
|
||||
<< Qt::ToolButtonTextOnly;
|
||||
QTest::newRow("Qt::ToolButtonIconOnly") << Qt::ToolButtonIconOnly << Qt::ToolButtonIconOnly << Qt::ToolButtonIconOnly << Qt::ToolButtonTextOnly;
|
||||
QTest::newRow("Qt::ToolButtonTextOnly") << Qt::ToolButtonTextOnly << Qt::ToolButtonTextOnly << Qt::ToolButtonTextOnly << Qt::ToolButtonTextOnly;
|
||||
}
|
||||
|
||||
void tst_KToolBar::testToolButtonStyleXmlGui()
|
||||
{
|
||||
QFETCH(Qt::ToolButtonStyle, toolButtonStyle);
|
||||
QFETCH(Qt::ToolButtonStyle, expectedStyleMainToolbar);
|
||||
QFETCH(Qt::ToolButtonStyle, expectedStyleOtherToolbar);
|
||||
QFETCH(Qt::ToolButtonStyle, expectedStyleCleanToolbar);
|
||||
const Qt::ToolButtonStyle mainToolBarDefaultStyle = Qt::ToolButtonTextBesideIcon; // was TextUnderIcon before KDE-4.4.0
|
||||
KConfig config(QStringLiteral("tst_KToolBar"));
|
||||
KConfigGroup group(&config, QStringLiteral("group"));
|
||||
{
|
||||
TestXmlGuiWindow kmw(m_xml, "tst_ktoolbar.rc");
|
||||
kmw.createActions(QStringList() << QStringLiteral("go_up"));
|
||||
kmw.createGUI();
|
||||
KToolBar *mainToolBar = kmw.toolBarByName(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBarByName(QStringLiteral("otherToolBar"));
|
||||
KToolBar *cleanToolBar = kmw.toolBarByName(QStringLiteral("cleanToolBar"));
|
||||
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)mainToolBarDefaultStyle);
|
||||
QCOMPARE((int)otherToolBar->toolButtonStyle(), (int)Qt::ToolButtonTextUnderIcon); // from xml
|
||||
QCOMPARE((int)cleanToolBar->toolButtonStyle(), (int)Qt::ToolButtonTextBesideIcon);
|
||||
|
||||
// Changing settings for a given toolbar, as user
|
||||
mainToolBar->setToolButtonStyle(toolButtonStyle);
|
||||
otherToolBar->setToolButtonStyle(toolButtonStyle);
|
||||
|
||||
// Save settings
|
||||
kmw.saveMainWindowSettings(group);
|
||||
|
||||
#ifdef WITH_QTDBUS // the change notification uses DBus
|
||||
// Now change KDE-global setting
|
||||
changeGlobalToolButtonStyleSetting(QStringLiteral("IconOnly"), QStringLiteral("TextOnly"));
|
||||
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)expectedStyleMainToolbar);
|
||||
QCOMPARE((int)otherToolBar->toolButtonStyle(), (int)expectedStyleOtherToolbar);
|
||||
QCOMPARE((int)cleanToolBar->toolButtonStyle(), (int)expectedStyleCleanToolbar);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void tst_KToolBar::changeGlobalToolButtonStyleSetting(const QString &mainToolBar, const QString &otherToolBars)
|
||||
{
|
||||
KConfigGroup group(KSharedConfig::openConfig(), QStringLiteral("Toolbar style"));
|
||||
group.writeEntry("ToolButtonStyle", mainToolBar);
|
||||
group.writeEntry("ToolButtonStyleOtherToolbars", otherToolBars);
|
||||
group.sync();
|
||||
|
||||
// Same dbus connect as the one in KToolBar. We want our spy to be notified of receiving it.
|
||||
#ifdef WITH_QTDBUS
|
||||
QDBusConnection::sessionBus().connect(QString(),
|
||||
QStringLiteral("/KToolBar"),
|
||||
QStringLiteral("org.kde.KToolBar"),
|
||||
QStringLiteral("styleChanged"),
|
||||
this,
|
||||
SIGNAL(signalAppearanceChanged()));
|
||||
QSignalSpy spy(this, &tst_KToolBar::signalAppearanceChanged);
|
||||
|
||||
KToolBar::emitToolbarStyleChanged();
|
||||
spy.wait(2000);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_KToolBar::deleteGlobalToolButtonStyleSetting()
|
||||
{
|
||||
KConfigGroup group(KSharedConfig::openConfig(), QStringLiteral("Toolbar style"));
|
||||
group.deleteEntry("ToolButtonStyle");
|
||||
group.deleteEntry("ToolButtonStyleOtherToolbars");
|
||||
KSharedConfig::openConfig()->sync();
|
||||
}
|
||||
|
||||
void tst_KToolBar::testToolBarPosition()
|
||||
{
|
||||
TestXmlGuiWindow kmw(m_xml, "tst_ktoolbar.rc");
|
||||
kmw.createActions(QStringList() << QStringLiteral("go_up"));
|
||||
kmw.createGUI();
|
||||
KToolBar *mainToolBar = kmw.toolBarByName(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = kmw.toolBarByName(QStringLiteral("otherToolBar"));
|
||||
QCOMPARE(kmw.toolBarArea(mainToolBar), Qt::TopToolBarArea);
|
||||
QCOMPARE(kmw.toolBarArea(otherToolBar), Qt::BottomToolBarArea);
|
||||
}
|
||||
|
||||
void tst_KToolBar::testXmlGuiSwitching()
|
||||
{
|
||||
const QByteArray windowXml =
|
||||
"<?xml version = '1.0'?>\n"
|
||||
"<!DOCTYPE gui SYSTEM \"kpartgui.dtd\">\n"
|
||||
"<gui version=\"1\" name=\"foo\" >\n"
|
||||
"<MenuBar>\n"
|
||||
"</MenuBar>\n"
|
||||
"</gui>\n";
|
||||
TestXmlGuiWindow kmw(windowXml, "tst_ktoolbar.rc");
|
||||
kmw.createActions(QStringList() << QStringLiteral("go_up"));
|
||||
kmw.createGUI();
|
||||
TestGuiClient firstClient(m_xml);
|
||||
kmw.guiFactory()->addClient(&firstClient);
|
||||
|
||||
{
|
||||
// qDebug() << "Added gui client";
|
||||
KToolBar *mainToolBar = firstClient.toolBarByName(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = firstClient.toolBarByName(QStringLiteral("otherToolBar"));
|
||||
KToolBar *bigToolBar = firstClient.toolBarByName(QStringLiteral("bigToolBar"));
|
||||
KToolBar *hiddenToolBar = firstClient.toolBarByName(QStringLiteral("hiddenToolBar"));
|
||||
KToolBar *secondHiddenToolBar = firstClient.toolBarByName(QStringLiteral("secondHiddenToolBar"));
|
||||
QCOMPARE(hiddenToolBar->isHidden(), true);
|
||||
QCOMPARE(secondHiddenToolBar->isHidden(), true);
|
||||
// Make (unsaved) changes as user
|
||||
QMetaObject::invokeMethod(mainToolBar, "slotContextTextRight"); // mainToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
QMetaObject::invokeMethod(mainToolBar, "slotContextRight"); // kmw.addToolBar(Qt::RightToolBarArea, mainToolBar);
|
||||
otherToolBar->setIconDimensions(35);
|
||||
bigToolBar->setIconDimensions(35);
|
||||
bigToolBar->hide();
|
||||
hiddenToolBar->show();
|
||||
}
|
||||
kmw.guiFactory()->removeClient(&firstClient);
|
||||
// qDebug() << "Removed gui client";
|
||||
QVERIFY(!kmw.guiFactory()->container(QStringLiteral("mainToolBar"), &kmw));
|
||||
QVERIFY(!kmw.guiFactory()->container(QStringLiteral("otherToolBar"), &kmw));
|
||||
QVERIFY(!kmw.guiFactory()->container(QStringLiteral("bigToolBar"), &kmw));
|
||||
QVERIFY(!kmw.guiFactory()->container(QStringLiteral("mainToolBar"), &firstClient));
|
||||
QVERIFY(!kmw.guiFactory()->container(QStringLiteral("otherToolBar"), &firstClient));
|
||||
QVERIFY(!kmw.guiFactory()->container(QStringLiteral("bigToolBar"), &firstClient));
|
||||
|
||||
kmw.guiFactory()->addClient(&firstClient);
|
||||
// qDebug() << "Re-added gui client";
|
||||
KToolBar *mainToolBar = firstClient.toolBarByName(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = firstClient.toolBarByName(QStringLiteral("otherToolBar"));
|
||||
KToolBar *bigToolBar = firstClient.toolBarByName(QStringLiteral("bigToolBar"));
|
||||
KToolBar *cleanToolBar = firstClient.toolBarByName(QStringLiteral("cleanToolBar"));
|
||||
KToolBar *hiddenToolBar = firstClient.toolBarByName(QStringLiteral("hiddenToolBar"));
|
||||
KToolBar *secondHiddenToolBar = firstClient.toolBarByName(QStringLiteral("secondHiddenToolBar"));
|
||||
QCOMPARE((int)mainToolBar->toolButtonStyle(), (int)Qt::ToolButtonTextBesideIcon);
|
||||
QCOMPARE(mainToolBar->isHidden(), false);
|
||||
QCOMPARE(kmw.toolBarArea(mainToolBar), Qt::RightToolBarArea);
|
||||
QCOMPARE(mainToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::MainToolbar));
|
||||
QCOMPARE(otherToolBar->iconSize().width(), 35);
|
||||
QCOMPARE(bigToolBar->iconSize().width(), 35);
|
||||
QCOMPARE(cleanToolBar->iconSize().width(), KIconLoader::global()->currentSize(KIconLoader::Toolbar));
|
||||
QCOMPARE(bigToolBar->isHidden(), true);
|
||||
QCOMPARE(hiddenToolBar->isHidden(), false);
|
||||
QCOMPARE(secondHiddenToolBar->isHidden(), true);
|
||||
|
||||
// Now save, and check what we saved
|
||||
KConfig config(QStringLiteral("tst_KToolBar"));
|
||||
KConfigGroup group(&config, QStringLiteral("group"));
|
||||
kmw.saveMainWindowSettings(group);
|
||||
QCOMPARE(group.group(QStringLiteral("Toolbar bigToolBar")).readEntry("IconSize", 0), 35);
|
||||
QCOMPARE(group.group(QStringLiteral("Toolbar otherToolBar")).readEntry("IconSize", 0), 35);
|
||||
QVERIFY(!group.group(QStringLiteral("Toolbar cleanToolBar")).hasKey("IconSize"));
|
||||
// QCOMPARE(group.group("Toolbar bigToolBar").readEntry("Hidden", false), true);
|
||||
// QVERIFY(!group.group("Toolbar cleanToolBar").hasKey("Hidden"));
|
||||
// QVERIFY(!group.group("Toolbar hiddenToolBar").hasKey("Hidden"));
|
||||
|
||||
// Recreate window and apply config; is hidden toolbar shown as expected?
|
||||
{
|
||||
TestXmlGuiWindow kmw2(windowXml, "tst_ktoolbar.rc");
|
||||
kmw2.createActions(QStringList() << QStringLiteral("go_up"));
|
||||
kmw2.createGUI();
|
||||
TestGuiClient firstClient(m_xml);
|
||||
kmw2.guiFactory()->addClient(&firstClient);
|
||||
|
||||
KToolBar *mainToolBar = firstClient.toolBarByName(QStringLiteral("mainToolBar"));
|
||||
KToolBar *otherToolBar = firstClient.toolBarByName(QStringLiteral("otherToolBar"));
|
||||
KToolBar *bigToolBar = firstClient.toolBarByName(QStringLiteral("bigToolBar"));
|
||||
KToolBar *hiddenToolBar = firstClient.toolBarByName(QStringLiteral("hiddenToolBar"));
|
||||
KToolBar *secondHiddenToolBar = firstClient.toolBarByName(QStringLiteral("secondHiddenToolBar"));
|
||||
QCOMPARE(bigToolBar->isHidden(), false);
|
||||
QCOMPARE(hiddenToolBar->isHidden(), true);
|
||||
QCOMPARE(secondHiddenToolBar->isHidden(), true);
|
||||
|
||||
kmw2.show();
|
||||
|
||||
// Check that secondHiddenToolBar is not shown+hidden immediately?
|
||||
m_showWasCalled = false;
|
||||
secondHiddenToolBar->installEventFilter(this);
|
||||
kmw2.applyMainWindowSettings(group);
|
||||
|
||||
QCOMPARE(mainToolBar->isHidden(), false);
|
||||
QCOMPARE(kmw2.toolBarArea(mainToolBar), Qt::RightToolBarArea);
|
||||
QCOMPARE(otherToolBar->iconSize().width(), 35);
|
||||
QCOMPARE(bigToolBar->iconSize().width(), 35);
|
||||
QCOMPARE(bigToolBar->isHidden(), true);
|
||||
QCOMPARE(hiddenToolBar->isHidden(), false);
|
||||
QCOMPARE(secondHiddenToolBar->isHidden(), true);
|
||||
QVERIFY(!m_showWasCalled);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_KToolBar::testKAuthorizedDisableToggleAction()
|
||||
{
|
||||
TestXmlGuiWindow kmw(m_xml, "tst_ktoolbar.rc");
|
||||
kmw.createGUI();
|
||||
|
||||
const auto toolbars = kmw.toolBars();
|
||||
for (KToolBar *toolbar : toolbars) {
|
||||
QVERIFY(!toolbar->toggleViewAction()->isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
bool tst_KToolBar::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
Q_UNUSED(watched);
|
||||
if (event->type() == QEvent::Show) {
|
||||
m_showWasCalled = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "ktoolbar_unittest.moc"
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2021 Felix Ernst <fe.a.ernst@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include "ktooltiphelper_unittest.h"
|
||||
|
||||
#include <KToolTipHelper>
|
||||
|
||||
#include <QTest>
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QMenu>
|
||||
#include <QStyle>
|
||||
#include <QToolButton>
|
||||
#include <QToolTip>
|
||||
#include <QWhatsThis>
|
||||
|
||||
#include <memory>
|
||||
|
||||
inline bool isWindowsCI()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
return qEnvironmentVariable("CI") == QLatin1String("true");
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString KToolTipHelper_UnitTest::shownToolTip(QWidget *widget)
|
||||
{
|
||||
QTest::mouseMove(m_frameWithoutToolTip);
|
||||
const bool resetWorked = QTest::qWaitFor(
|
||||
[]() {
|
||||
return !QToolTip::isVisible();
|
||||
},
|
||||
3000);
|
||||
if (!resetWorked) {
|
||||
qWarning("The tooltip did not properly hide itself after moving to an area without tooltip.");
|
||||
}
|
||||
|
||||
QTest::mouseMove(widget);
|
||||
if (!QTest::qWaitFor(&QToolTip::isVisible, widget->style()->styleHint(QStyle::SH_ToolTip_WakeUpDelay, nullptr, widget) + 1000)) {
|
||||
return QStringLiteral("");
|
||||
}
|
||||
return QToolTip::text();
|
||||
}
|
||||
|
||||
void KToolTipHelper_UnitTest::initTestCase()
|
||||
{
|
||||
if (isWindowsCI()) {
|
||||
QSKIP("GUI Tests on Windows CI are not supported");
|
||||
}
|
||||
|
||||
m_window.reset(new QMainWindow());
|
||||
m_centralWidget = new QWidget(m_window.get());
|
||||
m_centralWidget->setGeometry(0, 0, 100, 100);
|
||||
m_window->setCentralWidget(m_centralWidget);
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(m_centralWidget);
|
||||
|
||||
m_frame = new QFrame(m_centralWidget);
|
||||
m_frame->setFrameStyle(3);
|
||||
new QLabel(QStringLiteral("test area"), m_frame);
|
||||
layout->addWidget(m_frame);
|
||||
|
||||
m_toolButton = new QToolButton(m_centralWidget);
|
||||
layout->addWidget(m_toolButton);
|
||||
|
||||
m_frameWithoutToolTip = new QFrame(m_centralWidget);
|
||||
m_frameWithoutToolTip->setFrameStyle(2);
|
||||
new QLabel(QStringLiteral("no tooltip"), m_frameWithoutToolTip);
|
||||
layout->addWidget(m_frameWithoutToolTip);
|
||||
|
||||
qApp->installEventFilter(KToolTipHelper::instance());
|
||||
|
||||
m_window->show();
|
||||
m_window->ensurePolished();
|
||||
}
|
||||
|
||||
void KToolTipHelper_UnitTest::testGeneralWidget()
|
||||
{
|
||||
// tests without whatsThis()
|
||||
QVERIFY(shownToolTip(m_frameWithoutToolTip).isEmpty());
|
||||
m_frame->setToolTip(QStringLiteral("frame's tooltip"));
|
||||
QCOMPARE(shownToolTip(m_frame), m_frame->toolTip());
|
||||
|
||||
QHelpEvent *helpEvent = new QHelpEvent(QEvent::ToolTip, QPoint(1, 1), m_frame->mapToGlobal(QPoint(1, 1)));
|
||||
QVERIFY2(!KToolTipHelper::instance()->eventFilter(m_frame, helpEvent),
|
||||
"These most basic tooltips should not be filtered so applications can still rely"
|
||||
"on tooltip events in most cases.");
|
||||
|
||||
// tests with whatsThis()
|
||||
m_frame->setToolTip(QStringLiteral(""));
|
||||
m_frame->setWhatsThis(QStringLiteral("frame's whatsThis"));
|
||||
QVERIFY2(shownToolTip(m_frame).isEmpty(), "No whatsThisHint should be shown when no toolTip was set.");
|
||||
|
||||
m_frame->setToolTip(KToolTipHelper::whatsThisHintOnly());
|
||||
QVERIFY2(shownToolTip(m_frame) != KToolTipHelper::whatsThisHintOnly(),
|
||||
"The KToolTipHelper::whatsThisHintOnly()-string is no user-facing string"
|
||||
"and should therefore never actually be displayed.");
|
||||
|
||||
// test when whatsThis() == toolTip()
|
||||
m_frame->setToolTip(QStringLiteral("frame's whatsThis"));
|
||||
const QString noWhatsThisToolTip = shownToolTip(m_frame);
|
||||
QVERIFY(noWhatsThisToolTip.contains(m_frame->toolTip()));
|
||||
QVERIFY2(noWhatsThisToolTip.length() == m_frame->toolTip().length(), "No whatsThisHint should be shown when the toolTip is a similar string.");
|
||||
|
||||
m_frame->setToolTip(QStringLiteral("frame's tooltip"));
|
||||
const QString toolTip = shownToolTip(m_frame);
|
||||
QVERIFY(toolTip.contains(m_frame->toolTip()));
|
||||
QVERIFY2(toolTip.length() > m_frame->toolTip().length(), "The frame's toolTip is supposed to contain the whatsThisHint.");
|
||||
|
||||
auto layout = new QVBoxLayout(m_frame);
|
||||
auto subFrame = std::unique_ptr<QFrame>(new QFrame(m_frame));
|
||||
new QLabel(QStringLiteral("subFrame"), subFrame.get());
|
||||
layout->addWidget(subFrame.get());
|
||||
QCOMPARE(shownToolTip(subFrame.get()), toolTip);
|
||||
|
||||
subFrame->setToolTip(QStringLiteral("subFrame's tooltip"));
|
||||
QCOMPARE(shownToolTip(subFrame.get()), subFrame->toolTip());
|
||||
}
|
||||
|
||||
void KToolTipHelper_UnitTest::testInvokingWhatsThis()
|
||||
{
|
||||
m_frame->setWhatsThis(QStringLiteral("frame's whatsThis"));
|
||||
m_frame->setToolTip(KToolTipHelper::whatsThisHintOnly());
|
||||
shownToolTip(m_frame);
|
||||
QTest::keyClick(m_frame, Qt::Key_Shift);
|
||||
QVERIFY2(QTest::qWaitFor(
|
||||
[]() {
|
||||
return !QToolTip::isVisible();
|
||||
},
|
||||
4000),
|
||||
"whatsThis should be shown now.");
|
||||
QVERIFY2(shownToolTip(m_frame).isEmpty(),
|
||||
"A toolTip was shown which shouldn't be possible because a WhatsThis widget"
|
||||
"should be displayed at this moment.");
|
||||
QWhatsThis::hideText();
|
||||
QVERIFY2(!shownToolTip(m_frame).isEmpty(),
|
||||
"A toolTip was not shown although this should now be possible again "
|
||||
"because the WhatsThis widget was just hidden.");
|
||||
}
|
||||
|
||||
void KToolTipHelper_UnitTest::testQToolButton()
|
||||
{
|
||||
QVERIFY(shownToolTip(m_toolButton).isEmpty());
|
||||
|
||||
auto action = std::unique_ptr<QAction>(new QAction(QStringLiteral("action")));
|
||||
action->setToolTip(QStringLiteral("action's tooltip"));
|
||||
m_toolButton->setDefaultAction(action.get());
|
||||
QCOMPARE(shownToolTip(m_toolButton), action->toolTip());
|
||||
|
||||
auto helpEvent = std::unique_ptr<QHelpEvent>(new QHelpEvent(QEvent::ToolTip, QPoint(1, 1), m_toolButton->mapToGlobal(QPoint(1, 1))));
|
||||
QVERIFY2(!KToolTipHelper::instance()->eventFilter(m_toolButton, helpEvent.get()),
|
||||
"These most basic tooltips should not be filtered so applications can still rely"
|
||||
"on tooltip events in most cases.");
|
||||
|
||||
action->setShortcut(Qt::CTRL | Qt::Key_K);
|
||||
const QString toolTip(shownToolTip(m_toolButton));
|
||||
QVERIFY(toolTip.contains(action->toolTip()));
|
||||
// qDebug("%s > %s", qPrintable(toolTip), qPrintable(action->toolTip()));
|
||||
QVERIFY2(toolTip.length() > action->toolTip().length(), "The Keyboard shortcut should be visible.");
|
||||
|
||||
action->setWhatsThis(QStringLiteral("action's whatsThis"));
|
||||
const QString toolTipWithWhatsThisHint(shownToolTip(m_toolButton));
|
||||
QVERIFY(toolTipWithWhatsThisHint.contains(toolTip));
|
||||
// qDebug("%s > %s", qPrintable(toolTipWithWhatsThisHint), qPrintable(toolTip));
|
||||
QVERIFY2(toolTipWithWhatsThisHint.length() > toolTip.length(), "The whatsThisHint should be visible.");
|
||||
|
||||
action->setShortcut(QKeySequence());
|
||||
QVERIFY(shownToolTip(m_toolButton).length() < toolTipWithWhatsThisHint.length());
|
||||
|
||||
action->setWhatsThis(QStringLiteral(""));
|
||||
QCOMPARE(shownToolTip(m_toolButton), action->toolTip());
|
||||
|
||||
action->setToolTip(KToolTipHelper::whatsThisHintOnly());
|
||||
QVERIFY2(shownToolTip(m_toolButton).isEmpty(), "It should not show the whatsThisHint if there is no whatsThis text.");
|
||||
|
||||
action->setWhatsThis(QStringLiteral("action's whatsThis"));
|
||||
QVERIFY2(!shownToolTip(m_toolButton).isEmpty(), "The whatsThisHint should be shown.");
|
||||
}
|
||||
|
||||
void KToolTipHelper_UnitTest::testQMenu()
|
||||
{
|
||||
auto menu = std::unique_ptr<QMenu>(new QMenu(m_centralWidget));
|
||||
auto action = std::unique_ptr<QAction>(new QAction(QStringLiteral("action")));
|
||||
action->setDisabled(true); // The tooltip should also be shown for disabled actions.
|
||||
menu->addAction(action.get());
|
||||
menu->show();
|
||||
QVERIFY(shownToolTip(menu.get()).isEmpty());
|
||||
|
||||
action->setToolTip(QStringLiteral("action's tooltip"));
|
||||
const QString toolTip(shownToolTip(menu.get()));
|
||||
QCOMPARE(toolTip, action->toolTip());
|
||||
action->setShortcut(Qt::CTRL | Qt::Key_K);
|
||||
QCOMPARE(shownToolTip(menu.get()), toolTip);
|
||||
|
||||
action->setWhatsThis(QStringLiteral("action's whatsThis"));
|
||||
const QString toolTipWithWhatsThisHint(shownToolTip(menu.get()));
|
||||
QVERIFY2(toolTipWithWhatsThisHint.length() > toolTip.length(), "The tooltip is supposed to contain a whatsThisHint.");
|
||||
|
||||
action->setToolTip(KToolTipHelper::whatsThisHintOnly());
|
||||
QVERIFY(shownToolTip(menu.get()).length() < toolTipWithWhatsThisHint.length());
|
||||
|
||||
action->setWhatsThis(QStringLiteral(""));
|
||||
QVERIFY(shownToolTip(menu.get()).isEmpty());
|
||||
}
|
||||
|
||||
void KToolTipHelper_UnitTest::cleanupTestCase()
|
||||
{
|
||||
qApp->removeEventFilter(KToolTipHelper::instance());
|
||||
}
|
||||
|
||||
QTEST_MAIN(KToolTipHelper_UnitTest)
|
||||
|
||||
#include "moc_ktooltiphelper_unittest.cpp"
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2021 Felix Ernst <fe.a.ernst@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef KTOOLTIPHELPER_UNITTEST_H
|
||||
#define KTOOLTIPHELPER_UNITTEST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class QFrame;
|
||||
class QToolButton;
|
||||
class QWidget;
|
||||
|
||||
class KToolTipHelper_UnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QString shownToolTip(QWidget *widget);
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testGeneralWidget();
|
||||
void testInvokingWhatsThis();
|
||||
void testQToolButton();
|
||||
void testQMenu();
|
||||
void cleanupTestCase();
|
||||
|
||||
private:
|
||||
std::unique_ptr<QMainWindow> m_window;
|
||||
QWidget *m_centralWidget;
|
||||
QFrame *m_frame;
|
||||
QFrame *m_frameWithoutToolTip;
|
||||
QToolButton *m_toolButton;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2007 David Faure <faure@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef KXMLGUI_UNITTEST_H
|
||||
#define KXMLGUI_UNITTEST_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class KXmlGui_UnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testFindVersionNumber_data();
|
||||
void testFindVersionNumber();
|
||||
void testVersionHandlerSameVersion();
|
||||
void testVersionHandlerNewVersionNothingKept();
|
||||
void testVersionHandlerNewVersionUserChanges();
|
||||
void testPartMerging();
|
||||
void testPartMergingSettings();
|
||||
void testShortcutSchemeMerging();
|
||||
void testUiStandardsMerging_data();
|
||||
void testUiStandardsMerging();
|
||||
void testActionListAndSeparator();
|
||||
void testHiddenToolBar();
|
||||
void testCustomPlaceToolBar();
|
||||
void testDeletedContainers();
|
||||
void testAutoSaveSettings();
|
||||
void testXMLFileReplacement();
|
||||
void testTopLevelSeparator();
|
||||
void testMenuNames();
|
||||
void testClientDestruction();
|
||||
void testMenusNoXmlFile();
|
||||
void testShortcuts();
|
||||
void testPopupMenuParent();
|
||||
void testSpecificApplicationLanguageQLocale();
|
||||
void testSingleModifierQKeySequenceEndsWithPlus();
|
||||
void testSaveShortcutsAndRefresh();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef TESTGUICLIENT_H
|
||||
#define TESTGUICLIENT_H
|
||||
|
||||
#include <kactioncollection.h>
|
||||
#include <ktoolbar.h>
|
||||
#include <kxmlguiclient.h>
|
||||
#include <kxmlguifactory.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
// because setDOMDocument and setXML are protected
|
||||
class TestGuiClient : public KXMLGUIClient
|
||||
{
|
||||
public:
|
||||
explicit TestGuiClient(const QByteArray &xml = QByteArray())
|
||||
: KXMLGUIClient()
|
||||
{
|
||||
if (!xml.isNull()) {
|
||||
setXML(QString::fromLatin1(xml));
|
||||
}
|
||||
}
|
||||
void setXMLFilePublic(const QString &file, bool merge = false, bool setXMLDoc = true)
|
||||
{
|
||||
setXMLFile(file, merge, setXMLDoc);
|
||||
}
|
||||
void setLocalXMLFilePublic(const QString &file)
|
||||
{
|
||||
setLocalXMLFile(file);
|
||||
}
|
||||
void createGUI(const QByteArray &xml, bool withUiStandards = false)
|
||||
{
|
||||
if (withUiStandards) {
|
||||
setXMLFile(KXMLGUIClient::standardsXmlFileLocation());
|
||||
}
|
||||
|
||||
setXML(QString::fromLatin1(xml), true);
|
||||
}
|
||||
void mergeXML(const QByteArray &xml)
|
||||
{
|
||||
setXML(QString::fromLatin1(xml), true);
|
||||
}
|
||||
void createActions(const QStringList &actionNames)
|
||||
{
|
||||
KActionCollection *coll = actionCollection();
|
||||
for (const QString &actionName : actionNames) {
|
||||
coll->addAction(actionName)->setText(QStringLiteral("Action"));
|
||||
}
|
||||
}
|
||||
|
||||
// Find a toolbar (created by this guiclient)
|
||||
KToolBar *toolBarByName(const QString &name)
|
||||
{
|
||||
// qDebug() << "containers:" << factory()->containers("ToolBar");
|
||||
QWidget *toolBarW = factory()->container(name, this);
|
||||
if (!toolBarW) {
|
||||
qWarning() << "No toolbar found with name" << name;
|
||||
}
|
||||
Q_ASSERT(toolBarW);
|
||||
KToolBar *toolBar = qobject_cast<KToolBar *>(toolBarW);
|
||||
Q_ASSERT(toolBar);
|
||||
return toolBar;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* TESTGUICLIENT_H */
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef TESTXMLGUIWINDOW_H
|
||||
#define TESTXMLGUIWINDOW_H
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <QResizeEvent>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTest>
|
||||
|
||||
#include <kactioncollection.h>
|
||||
#include <ktoolbar.h>
|
||||
#include <kxmlguifactory.h>
|
||||
#include <kxmlguiwindow.h>
|
||||
|
||||
class TestXmlGuiWindow : public KXmlGuiWindow
|
||||
{
|
||||
public:
|
||||
TestXmlGuiWindow(const QByteArray &xml, const char *localXmlFileName)
|
||||
: KXmlGuiWindow()
|
||||
{
|
||||
QVERIFY(m_userFile.open());
|
||||
m_userFile.write(xml);
|
||||
m_fileName = m_userFile.fileName(); // remember filename
|
||||
Q_ASSERT(!m_fileName.isEmpty());
|
||||
m_userFile.close(); // write to disk
|
||||
// just so that we can use kedittoolbar (because m_fileName is absolute)
|
||||
setLocalXMLFile(QString::fromLatin1(localXmlFileName));
|
||||
}
|
||||
void createGUI()
|
||||
{
|
||||
// This merges in ui_standards.rc, too.
|
||||
KXmlGuiWindow::createGUI(m_fileName);
|
||||
}
|
||||
void createGUIBad()
|
||||
{
|
||||
KXmlGuiWindow::createGUI(QStringLiteral("dontexist.rc"));
|
||||
}
|
||||
|
||||
// Same as in KMainWindow_UnitTest
|
||||
void reallyResize(int width, int height)
|
||||
{
|
||||
const QSize oldSize = size();
|
||||
resize(width, height);
|
||||
// Send the pending resize event (resize() only sets Qt::WA_PendingResizeEvent)
|
||||
QResizeEvent e(size(), oldSize);
|
||||
QApplication::sendEvent(this, &e);
|
||||
}
|
||||
|
||||
// KMainWindow::toolBar(name) creates it if not found, and we don't want that.
|
||||
// Also this way we test container() rather than just doing a findChild.
|
||||
KToolBar *toolBarByName(const QString &name)
|
||||
{
|
||||
KXMLGUIFactory *factory = guiFactory();
|
||||
// qDebug() << "containers:" << factory->containers("ToolBar");
|
||||
QWidget *toolBarW = factory->container(name, this);
|
||||
if (!toolBarW) {
|
||||
qWarning() << "No toolbar found with name" << name;
|
||||
}
|
||||
Q_ASSERT(toolBarW);
|
||||
KToolBar *toolBar = qobject_cast<KToolBar *>(toolBarW);
|
||||
Q_ASSERT(toolBar);
|
||||
return toolBar;
|
||||
}
|
||||
QMenu *menuByName(const QString &name)
|
||||
{
|
||||
KXMLGUIFactory *factory = guiFactory();
|
||||
QWidget *menuW = factory->container(name, this);
|
||||
Q_ASSERT(menuW);
|
||||
QMenu *menu = qobject_cast<QMenu *>(menuW);
|
||||
Q_ASSERT(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
void createActions(const QStringList &actionNames)
|
||||
{
|
||||
KActionCollection *coll = actionCollection();
|
||||
for (const QString &actionName : actionNames) {
|
||||
coll->addAction(actionName)->setText(QStringLiteral("Action"));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QTemporaryFile m_userFile;
|
||||
QString m_fileName;
|
||||
};
|
||||
|
||||
#endif /* TESTXMLGUIWINDOW_H */
|
||||
@@ -0,0 +1,10 @@
|
||||
### KApiDox Project-specific Overrides File
|
||||
|
||||
# define so that deprecated API is not skipped
|
||||
PREDEFINED += \
|
||||
"KXMLGUI_ENABLE_DEPRECATED_SINCE(x, y)=1" \
|
||||
"KXMLGUI_BUILD_DEPRECATED_SINCE(x, y)=1" \
|
||||
"KXMLGUI_DEPRECATED_VERSION(x, y, t)=" \
|
||||
"KXMLGUI_DEPRECATED_VERSION_BELATED(x, y, xt, yt, t)=" \
|
||||
"KXMLGUI_ENUMERATOR_DEPRECATED_VERSION(x, y, t)=" \
|
||||
"KXMLGUI_ENUMERATOR_DEPRECATED_VERSION_BELATED(x, y, xt, yt, t)="
|
||||
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Script to automatically update the "kdepackages.h" file
|
||||
# FIXME - This is a slow script. Rewrite me using a smart logic. Thanks!
|
||||
#
|
||||
import string
|
||||
import urllib
|
||||
import re
|
||||
|
||||
def unescape(text):
|
||||
text = text.replace(" "," ")
|
||||
text = text.replace("‑","-")
|
||||
text = text.replace("&","&")
|
||||
return text
|
||||
|
||||
|
||||
print "Fetching products and components from bugs.kde.org..."
|
||||
|
||||
pkg = open("src/kdepackages.h","w")
|
||||
pkg.write("// DO NOT EDIT - EDIT products in bugs.kde.org and run ./make_kdepackages_updated.py in kxmlgui to update\n")
|
||||
pkg.write("const char * const packages[] = {\n")
|
||||
|
||||
data = urllib.urlopen('https://bugs.kde.org/describecomponents.cgi').read()
|
||||
|
||||
for line in string.split(data,'\n'):
|
||||
print "====parsing:"
|
||||
#print line
|
||||
match = re.search('(describecomponents.cgi\?product=.*)">(.*)</a>', line)
|
||||
if match:
|
||||
product = match.group(2)
|
||||
link = match.group(1)
|
||||
|
||||
link = 'https://bugs.kde.org/' + link
|
||||
data2 = urllib.urlopen(link).read()
|
||||
|
||||
productname = unescape(product)
|
||||
print productname
|
||||
pkg.write(" \"" + productname + "\",\n")
|
||||
data2 = string.split(data2,'\n')
|
||||
iter = 0
|
||||
end = len(data2)
|
||||
print "link: " + link
|
||||
while( iter < end-1 ):
|
||||
iter = iter+1
|
||||
line = data2[iter]
|
||||
match = re.search('amp;resolution=---">(.*)</a>', line)
|
||||
if match:
|
||||
product = match.group(1)
|
||||
product = unescape(product)
|
||||
print "found component: " + product
|
||||
if product!="general":
|
||||
pkg.write(" \"" + productname + "/" + product + "\",\n")
|
||||
print productname + "/" + product
|
||||
|
||||
pkg.write("0 };\n")
|
||||
pkg.close()
|
||||
@@ -0,0 +1,20 @@
|
||||
maintainer:
|
||||
description: User configurable main windows
|
||||
tier: 3
|
||||
type: integration
|
||||
platforms:
|
||||
- name: Linux
|
||||
- name: FreeBSD
|
||||
- name: Windows
|
||||
- name: macOS
|
||||
- name: Android
|
||||
portingAid: false
|
||||
deprecated: false
|
||||
release: true
|
||||
libraries:
|
||||
- cmake: "KF6::XmlGui"
|
||||
cmakename: KF6XmlGui
|
||||
|
||||
public_lib: true
|
||||
group: Frameworks
|
||||
subgroup: Tier 3
|
||||