[calamares] Use DBus activation instead of KDSAG

This commit is contained in:
Adriaan de Groot 2021-09-16 13:37:38 +02:00
parent a6ba3dfce0
commit 261c3587a5
16 changed files with 14 additions and 3540 deletions

View File

@ -1,488 +0,0 @@
The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
You may use, distribute and copy the KD Tools Library under the terms of
GNU Library General Public License version 2, which is displayed below.
-------------------------------------------------------------------------
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 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 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.
GNU LIBRARY GENERAL PUBLIC LICENSE
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 a brief 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 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!

View File

@ -1,481 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#include "kdlockedsharedmemorypointer.h"
#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN )
#ifndef QT_NO_SHAREDMEMORY
namespace kdtools
{
}
using namespace kdtools;
KDLockedSharedMemoryPointerBase::KDLockedSharedMemoryPointerBase( QSharedMemory * m )
: locker( m ),
mem( m )
{
}
KDLockedSharedMemoryPointerBase::KDLockedSharedMemoryPointerBase( QSharedMemory & m )
: locker( &m ),
mem( &m )
{
}
KDLockedSharedMemoryPointerBase::~KDLockedSharedMemoryPointerBase() {}
void * KDLockedSharedMemoryPointerBase::get() {
return mem ? mem->data() : 0 ;
}
const void * KDLockedSharedMemoryPointerBase::get() const {
return mem ? mem->data() : 0 ;
}
size_t KDLockedSharedMemoryPointerBase::byteSize() const {
return mem ? mem->size() : 0;
}
/*!
\class KDLockedSharedMemoryPointer
\ingroup core raii smartptr
\brief Locking pointer for Qt shared memory segments
\since_c 2.1
(The exception safety of this class has not been evaluated yet.)
KDLockedSharedMemoryPointer is a smart immutable pointer, which gives convenient and safe access to a QSharedMemory data segment.
The content of a KDLockedSharedMemoryPointer cannot be changed during it's lifetime.
You can use this class like a normal pointer to the shared memory segment and be sure it's locked while accessing it.
\note You can only put simple types/structs/classes into it. structs and classes shall not contain any other pointers. See the
documentation of QSharedMemory for details.
*/
/*!
\fn KDLockedSharedMemoryPointer::KDLockedSharedMemoryPointer( QSharedMemory * mem )
Constructor. Constructs a KDLockedSharedMemory pointer which points to the data segment of \a mem.
The constructor locks \a mem. If the memory segment is already locked by another process, this constructor
blocks until the lock is released.
\post data() == mem->data() and the memory segment has been locked
*/
/*!
\fn KDLockedSharedMemoryPointer::KDLockedSharedMemoryPointer( QSharedMemory & mem )
\overload
\post data() == mem.data() and the memory segment has been locked
*/
/*!
\fn KDLockedSharedMemoryPointer::~KDLockedSharedMemoryPointer()
Destructor. Unlocks the shared memory segment.
\post The shared memory segment has been unlocked
*/
/*!
\fn T * KDLockedSharedMemoryPointer::get()
\returns a pointer to the contained object.
*/
/*!
\fn const T * KDLockedSharedMemoryPointer::get() const
\returns a const pointer to the contained object
\overload
*/
/*!
\fn T * KDLockedSharedMemoryPointer::data()
Equivalent to get(), provided for consistency with Qt naming conventions.
*/
/*!
\fn const T * KDLockedSharedMemoryPointer::data() const
\overload
*/
/*!
\fn T & KDLockedSharedMemoryPointer::operator*()
Dereference operator. Returns \link get() *get()\endlink.
*/
/*!
\fn const T & KDLockedSharedMemoryPointer::operator*() const
Dereference operator. Returns \link get() *get()\endlink.
\overload
*/
/*!
\fn T * KDLockedSharedMemoryPointer::operator->()
Member-by-pointer operator. Returns get().
*/
/*!
\fn const T * KDLockedSharedMemoryPointer::operator->() const
Member-by-pointer operator. Returns get().
\overload
*/
/*!
\class KDLockedSharedMemoryArray
\ingroup core raii smartptr
\brief Locking array pointer to Qt shared memory segments
\since_c 2.1
(The exception safety of this class has not been evaluated yet.)
KDLockedSharedMemoryArray is a smart immutable pointer, which gives convenient and safe access to array data stored in a QSharedMemory
data segment.
The content of a KDLockedSharedMemoryArray cannot be changed during it's lifetime.
You can use this class like a normal pointer to the shared memory segment and be sure it's locked while accessing it.
\note You can only put arrays of simple types/structs/classes into it. structs and classes shall not contain any other pointers. See the
documentation of QSharedMemory for details.
\sa KDLockedSharedMemoryPointer
*/
/*!
\fn KDLockedSharedMemoryArray::KDLockedSharedMemoryArray( QSharedMemory* mem )
Constructor. Constructs a KDLockedSharedMemoryArray which points to the data segment of \a mem. The constructor locks \a mem. If the memory
segment is already locked by another process, this constructor blocks until the lock is release.
\post get() == mem->data() and the memory segment has been locked
*/
/*!
\fn KDLockedSharedMemoryArray::KDLockedSharedMemoryArray( QSharedMemory& mem )
\overload
\post get() == mem->data() and the memory segment has been locked
*/
/*!
\typedef KDLockedSharedMemoryArray::size_type
Typedef for std::size_t. Provided for STL compatibility.
*/
/*!
\typedef KDLockedSharedMemoryArray::difference_type
Typedef for std::ptrdiff_t. Provided for STL compatibility.
*/
/*!
\typedef KDLockedSharedMemoryArray::iterator
Typedef for T*. Provided for STL compatibility.
\since_t 2.2
*/
/*!
\typedef KDLockedSharedMemoryArray::const_iterator
Typedef for const T*. Provided for STL compatibility.
\since_t 2.2
*/
/*!
\typedef KDLockedSharedMemoryArray::reverse_iterator
Typedef for std::reverse_iterator< \link KDLockedSharedMemoryArray::iterator iterator\endlink >. Provided for STL compatibility.
\since_t 2.2
*/
/*!
\typedef KDLockedSharedMemoryArray::const_reverse_iterator
Typedef for std::reverse_iterator< \link KDLockedSharedMemoryArray::const_iterator const_iterator\endlink >. Provided for STL compatibility.
\since_t 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::iterator KDLockedSharedMemoryArray::begin()
Returns an \link KDLockedSharedMemoryArray::iterator iterator\endlink pointing to the first item of the array.
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::const_iterator KDLockedSharedMemoryArray::begin() const
\overload
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::iterator KDLockedSharedMemoryArray::end()
Returns an \link KDLockedSharedMemoryArray::iterator iterator\endlink pointing to the item after the last item of the array.
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::const_iterator KDLockedSharedMemoryArray::end() const
\overload
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::reverse_iterator KDLockedSharedMemoryArray::rbegin()
Returns an \link KDLockedSharedMemoryArray::reverse_iterator reverse_iterator\endlink pointing to the item after the last item of the array.
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::const_reverse_iterator KDLockedSharedMemoryArray::rbegin() const
\overload
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::reverse_iterator KDLockedSharedMemoryArray::rend()
Returns an \link KDLockedSharedMemoryArray::reverse_iterator reverse_iterator\endlink pointing to the first item of the array.
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::const_reverse_iterator KDLockedSharedMemoryArray::rend() const
\overload
\since_f 2.2
*/
/*!
\fn KDLockedSharedMemoryArray::size_type KDLockedSharedMemoryArray::size() const
Returns the size of this array. The size is calculated from the storage size of T and
the size of the shared memory segment.
\since_f 2.2
*/
/*!
\fn T& KDLockedSharedMemoryArray::operator[]( difference_type n )
Array access operator. Returns a reference to the item at index position \a n.
*/
/*!
\fn const T& KDLockedSharedMemoryArray::operator[]( difference_type n ) const
\overload
*/
/*!
\fn T& KDLockedSharedMemoryArray::front()
Returns a reference to the first item in the array. This is the same as operator[](0).
*/
/*!
\fn const T& KDLockedSharedMemoryArray::front() const
\overload
*/
/*!
\fn T& KDLockedSharedMemoryArray::back()
Returns a reference to the last item in the array. This is the same as operator[](size()-1).
\since_f 2.2
*/
/*!
\fn const T& KDLockedSharedMemoryArray::back() const
\overload
\since_f 2.2
*/
#ifdef eKDTOOLSCORE_UNITTESTS
#include <KDUnitTest/Test>
#include <QThread>
#include <QUuid>
namespace
{
struct TestStruct
{
TestStruct( uint nn = 0 )
: n( nn ),
f( 0.0 ),
c( '\0' ),
b( false )
{
}
uint n;
double f;
char c;
bool b;
};
bool operator==( const TestStruct& lhs, const TestStruct& rhs )
{
return lhs.n == rhs.n && lhs.f == rhs.f && lhs.c == rhs.c && lhs.b == rhs.b;
}
class TestThread : public QThread
{
public:
TestThread( const QString& key )
: mem( key )
{
mem.attach();
}
void run()
{
while( true )
{
msleep( 100 );
kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem );
if( !p->b )
continue;
p->n = 5;
p->f = 3.14;
p->c = 'A';
p->b = false;
return;
}
}
QSharedMemory mem;
};
bool isConst( TestStruct* )
{
return false;
}
bool isConst( const TestStruct* )
{
return true;
}
}
KDAB_UNITTEST_SIMPLE( KDLockedSharedMemoryPointer, "kdcoretools" ) {
const QString key = QUuid::createUuid();
QSharedMemory mem( key );
const bool created = mem.create( sizeof( TestStruct ) );
assertTrue( created );
if ( !created )
return; // don't execute tests if shm coulnd't be created
// On Windows, shared mem is only available in increments of page
// size (4k), so don't fail if the segment is larger:
const unsigned long mem_size = mem.size();
assertGreaterOrEqual( mem_size, sizeof( TestStruct ) );
{
kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem );
assertTrue( p );
*p = TestStruct();
assertEqual( p->n, 0u );
assertEqual( p->f, 0.0 );
assertEqual( p->c, '\0' );
assertFalse( p->b );
}
{
TestThread thread( key );
assertEqual( thread.mem.key().toStdString(), key.toStdString() );
assertEqual( static_cast< unsigned long >( thread.mem.size() ), mem_size );
thread.start();
assertTrue( thread.isRunning() );
thread.wait( 2000 );
assertTrue( thread.isRunning() );
{
kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem );
p->b = true;
}
thread.wait( 2000 );
assertFalse( thread.isRunning() );
}
{
kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem );
assertEqual( p->n, 5u );
assertEqual( p->f, 3.14 );
assertEqual( p->c, 'A' );
assertFalse( p->b );
}
{
kdtools::KDLockedSharedMemoryPointer< TestStruct > p( mem );
assertEqual( mem.data(), p.get() );
assertEqual( p.get(), p.operator->() );
assertEqual( p.get(), &(*p) );
assertEqual( p.get(), p.data() );
assertFalse( isConst( p.get() ) );
}
{
const kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem );
assertEqual( mem.data(), p.get() );
assertEqual( p.get(), p.operator->() );
assertEqual( p.get(), &(*p) );
assertEqual( p.get(), p.data() );
assertTrue( isConst( p.get() ) );
}
{
QSharedMemory mem2( key + key );
const bool created2 = mem2.create( 16 * sizeof( TestStruct ) );
assertTrue( created2 );
if ( !created2 )
return; // don't execute tests if shm coulnd't be created
kdtools::KDLockedSharedMemoryArray<TestStruct> a( mem2 );
assertTrue( a );
assertEqual( a.get(), mem2.data() );
assertEqual( &a[0], a.get() );
a[1] = a[0];
assertTrue( a[0] == a[1] );
TestStruct ts;
ts.n = 5;
ts.f = 3.14;
a[0] = ts;
assertFalse( a[0] == a[1] );
assertEqual( a.front().n, ts.n );
assertEqual( a[0].f, ts.f );
a[0].n = 10;
assertEqual( a.front().n, 10u );
ts = a[0];
assertEqual( ts.n, 10u );
std::vector< TestStruct > v;
for( uint i = 0; i < a.size(); ++i )
v.push_back( TestStruct( i ) );
std::copy( v.begin(), v.end(), a.begin() );
for( uint i = 0; i < a.size(); ++i )
assertEqual( a[ i ].n, i );
assertEqual( a.front().n, 0u );
assertEqual( a.back().n, a.size() - 1 );
std::copy( v.begin(), v.end(), a.rbegin() );
for( uint i = 0; i < a.size(); ++i )
assertEqual( a[ i ].n, a.size() - 1 - i );
assertEqual( a.front().n, a.size() - 1 );
assertEqual( a.back().n, 0u );
}
}
#endif // KDTOOLSCORE_UNITTESTS
#endif // QT_NO_SHAREDMEMORY
#endif // QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN )

View File

@ -1,121 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#ifndef __KDTOOLS__CORE__KDLOCKEDSHAREDMEMORYPOINTER_H__
#define __KDTOOLS__CORE__KDLOCKEDSHAREDMEMORYPOINTER_H__
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN )
#ifndef QT_NO_SHAREDMEMORY
#include "kdsharedmemorylocker.h"
#include <QtCore/QSharedMemory>
#include <cassert>
#ifndef DOXYGEN_RUN
namespace kdtools {
#endif
class KDLockedSharedMemoryPointerBase {
protected:
explicit KDLockedSharedMemoryPointerBase( QSharedMemory * mem );
explicit KDLockedSharedMemoryPointerBase( QSharedMemory & mem );
~KDLockedSharedMemoryPointerBase();
// PENDING(marc) do we really want const propagation here? I
// usually declare all my RAII objects const...
void * get();
const void * get() const;
KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( get() )
size_t byteSize() const;
private:
KDSharedMemoryLocker locker;
QSharedMemory * const mem;
};
template< typename T>
class MAKEINCLUDES_EXPORT KDLockedSharedMemoryPointer : KDLockedSharedMemoryPointerBase {
KDAB_DISABLE_COPY( KDLockedSharedMemoryPointer );
public:
explicit KDLockedSharedMemoryPointer( QSharedMemory * m )
: KDLockedSharedMemoryPointerBase( m ) {}
explicit KDLockedSharedMemoryPointer( QSharedMemory & m )
: KDLockedSharedMemoryPointerBase( m ) {}
T * get() { return static_cast<T*>( KDLockedSharedMemoryPointerBase::get() ); }
const T * get() const { return static_cast<const T*>( KDLockedSharedMemoryPointerBase::get() ); }
T * data() { return static_cast<T*>( get() ); }
const T * data() const { return static_cast<const T*>( get() ); }
T & operator*() { assert( get() ); return *get(); }
const T & operator*() const { assert( get() ); return *get(); }
T * operator->() { return get(); }
const T * operator->() const { return get(); }
KDAB_USING_SAFE_BOOL_OPERATOR( KDLockedSharedMemoryPointerBase )
};
template <typename T>
class MAKEINCLUDES_EXPORT KDLockedSharedMemoryArray : KDLockedSharedMemoryPointerBase {
KDAB_DISABLE_COPY( KDLockedSharedMemoryArray );
public:
explicit KDLockedSharedMemoryArray( QSharedMemory * m )
: KDLockedSharedMemoryPointerBase( m ) {}
explicit KDLockedSharedMemoryArray( QSharedMemory & m )
: KDLockedSharedMemoryPointerBase( m ) {}
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T* iterator;
typedef const T* const_iterator;
typedef std::reverse_iterator< const_iterator > const_reverse_iterator;
typedef std::reverse_iterator< iterator > reverse_iterator;
iterator begin() { return get(); }
const_iterator begin() const { return get(); }
iterator end() { return begin() + size(); }
const_iterator end() const { return begin() + size(); }
reverse_iterator rbegin() { return reverse_iterator( end() ); }
const_reverse_iterator rbegin() const { return reverse_iterator( end() ); }
reverse_iterator rend() { return reverse_iterator( begin() ); }
const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); }
size_type size() const { return byteSize() / sizeof( T ); }
T * get() { return static_cast<T*>( KDLockedSharedMemoryPointerBase::get() ); }
const T * get() const { return static_cast<const T*>( KDLockedSharedMemoryPointerBase::get() ); }
T & operator[]( difference_type n ) { assert( get() ); return *(get()+n); }
const T & operator[]( difference_type n ) const { assert( get() ); return *(get()+n); }
T & front() { assert( get() ); return *get(); }
const T & front() const { assert( get() ); return *get(); }
T & back() { assert( get() ); return *( get() + size() - 1 ); }
const T & back() const { assert( get() ); return *( get() + size() - 1 ); }
KDAB_USING_SAFE_BOOL_OPERATOR( KDLockedSharedMemoryPointerBase )
};
#ifndef DOXYGEN_RUN
}
#endif
#endif /* QT_NO_SHAREDMEMORY */
#endif /* QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN ) */
#endif /* __KDTOOLS__CORE__KDLOCKEDSHAREDMEMORYPOINTER_H__ */

View File

@ -1,46 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#include "kdsharedmemorylocker.h"
#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN )
#include <QSharedMemory>
using namespace kdtools;
/*!
\class KDSharedMemoryLocker
\ingroup raii core
\brief Exception-safe and convenient wrapper around QSharedMemory::lock()
*/
/**
* Constructor. Locks the shared memory segment \a mem.
* If another process has locking the segment, this constructor blocks
* until the lock is released. The memory segments needs to be properly created or attached.
*/
KDSharedMemoryLocker::KDSharedMemoryLocker( QSharedMemory* mem )
: mem( mem )
{
mem->lock();
}
/**
* Destructor. Unlocks the shared memory segment associated with this
* KDSharedMemoryLocker.
*/
KDSharedMemoryLocker::~KDSharedMemoryLocker()
{
mem->unlock();
}
#ifdef KDAB_EVAL
#include KDAB_EVAL
static const EvalDialogChecker evalChecker( "KD Tools", false );
#endif
#endif

View File

@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#ifndef __KDTOOLS__CORE__KDSHAREDMEMORYLOCKER_H
#define __KDTOOLS__CORE__KDSHAREDMEMORYLOCKER_H
#include "kdtoolsglobal.h"
#if QT_VERSION < 0x040400 && !defined( DOXYGEN_RUN )
#ifdef Q_CC_GNU
#warning "Can't use KDTools KDSharedMemoryLocker with Qt versions prior to 4.4"
#endif
#else
class QSharedMemory;
#ifndef DOXYGEN_RUN
namespace kdtools
{
#endif
class KDTOOLSCORE_EXPORT KDSharedMemoryLocker
{
Q_DISABLE_COPY( KDSharedMemoryLocker )
public:
KDSharedMemoryLocker( QSharedMemory* mem );
~KDSharedMemoryLocker();
private:
QSharedMemory* const mem;
};
#ifndef DOXYGEN_RUN
}
#endif
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,147 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#ifndef KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H
#define KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H
#include <QtCore/QObject>
#ifndef QT_NO_SHAREDMEMORY
#include <QtCore/QStringList>
#include <QtCore/QMetaType>
#include "pimpl_ptr.h"
#include "DllMacro.h"
#include <algorithm>
template <typename T> class QVector;
class QCoreApplication;
class DLLEXPORT KDSingleApplicationGuard : public QObject
{
Q_OBJECT
Q_ENUMS( Policy )
Q_PROPERTY( bool operational READ isOperational )
Q_PROPERTY( bool exitRequested READ isExitRequested )
Q_PROPERTY( bool primaryInstance READ isPrimaryInstance NOTIFY becamePrimaryInstance )
Q_PROPERTY( Policy policy READ policy WRITE setPolicy NOTIFY policyChanged )
public:
enum Policy
{
NoPolicy = 0,
AutoKillOtherInstances = 1
};
explicit KDSingleApplicationGuard( QObject * parent=nullptr );
explicit KDSingleApplicationGuard( Policy policy, QObject * parent=nullptr );
explicit KDSingleApplicationGuard( const QStringList & arguments, QObject * parent=nullptr );
explicit KDSingleApplicationGuard( const QStringList & arguments, Policy policy, QObject * parent=nullptr );
~KDSingleApplicationGuard() override;
bool isOperational() const;
bool isExitRequested() const;
bool isPrimaryInstance() const;
Policy policy() const;
void setPolicy( Policy policy );
class Instance;
QVector<Instance> instances() const;
Q_SIGNALS:
void instanceStarted( const KDSingleApplicationGuard::Instance & instance );
void instanceExited( const KDSingleApplicationGuard::Instance & instance );
void exitRequested();
void raiseRequested();
void becamePrimaryInstance();
void becameSecondaryInstance();
void policyChanged( KDSingleApplicationGuard::Policy policy );
public Q_SLOTS:
void shutdownOtherInstances();
void killOtherInstances();
protected:
/*! \reimp */ bool event( QEvent * event ) override;
private:
#ifndef Q_WS_WIN
static void SIGINT_handler( int );
#endif
private:
friend struct ProcessInfo;
class Private;
kdtools::pimpl_ptr< Private > d;
};
class DLLEXPORT KDSingleApplicationGuard::Instance {
friend class ::KDSingleApplicationGuard;
friend class ::KDSingleApplicationGuard::Private;
Instance( const QStringList &, bool, qint64 );
public:
Instance();
Instance( const Instance & other );
~Instance();
void swap( Instance & other ) {
std::swap( d, other.d );
}
Instance & operator=( Instance other ) {
swap( other );
return *this;
}
bool isNull() const { return !d; }
bool isValid() const;
bool areArgumentsTruncated() const;
const QStringList & arguments() const;
qint64 pid() const;
void shutdown();
void kill();
void raise();
private:
class Private;
Private * d;
};
namespace std {
template <>
inline void swap( KDSingleApplicationGuard::Instance & lhs,
KDSingleApplicationGuard::Instance & rhs )
{
lhs.swap( rhs );
}
} // namespace std
QT_BEGIN_NAMESPACE
template <>
inline void qSwap( KDSingleApplicationGuard::Instance & lhs,
KDSingleApplicationGuard::Instance & rhs )
{
lhs.swap( rhs );
}
Q_DECLARE_METATYPE( KDSingleApplicationGuard::Instance )
Q_DECLARE_TYPEINFO( KDSingleApplicationGuard::Instance, Q_MOVABLE_TYPE );
QT_END_NAMESPACE
#endif // QT_NO_SHAREDMEMORY
#endif /* KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H */

View File

@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#include "kdtoolsglobal.h"
#include <QByteArray>
#include <algorithm>
namespace {
struct Version {
unsigned char v[3];
};
static inline bool operator<( const Version & lhs, const Version & rhs ) {
return std::lexicographical_compare( lhs.v, lhs.v + 3, rhs.v, rhs.v + 3 );
}
static inline bool operator==( const Version & lhs, const Version & rhs ) {
return std::equal( lhs.v, lhs.v + 3, rhs.v );
}
KDTOOLS_MAKE_RELATION_OPERATORS( Version, static inline )
}
static Version kdParseQtVersion( const char * const version ) {
if ( !version || qstrlen( version ) < 5 || version[1] != '.' || version[3] != '.' || ( version[5] != 0 && version[5] != '.' && version[5] != '-' ) )
return Version(); // parse error
const Version result = { { static_cast< unsigned char >( version[0] - '0' ),
static_cast< unsigned char >( version[2] - '0' ),
static_cast< unsigned char >( version[4] - '0' ) } };
return result;
}
bool _kdCheckQtVersion_impl( unsigned int major, unsigned int minor, unsigned int patchlevel ) {
static const Version actual = kdParseQtVersion( qVersion() ); // do this only once each run...
const Version requested = { { static_cast< unsigned char >( major ),
static_cast< unsigned char >( minor ),
static_cast< unsigned char >( patchlevel ) } };
return actual >= requested;
}

View File

@ -1,120 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#ifndef KDTOOLS_KDTOOLSGLOBAL_H
#define KDTOOLS_KDTOOLSGLOBAL_H
#include <QtCore/QtGlobal>
#define KDAB_DISABLE_COPY( x ) private: x( const x & ); x & operator=( const x & )
#ifdef KDTOOLS_SHARED
# ifdef BUILD_SHARED_KDTOOLSCORE
# define KDTOOLSCORE_EXPORT Q_DECL_EXPORT
# else
# define KDTOOLSCORE_EXPORT Q_DECL_IMPORT
# endif
# ifdef BUILD_SHARED_KDTOOLSGUI
# define KDTOOLSGUI_EXPORT Q_DECL_EXPORT
# else
# define KDTOOLSGUI_EXPORT Q_DECL_IMPORT
# endif
# ifdef BUILD_SHARED_KDTOOLSXML
# define KDTOOLSXML_EXPORT Q_DECL_EXPORT
# else
# define KDTOOLSXML_EXPORT Q_DECL_IMPORT
# endif
# ifdef BUILD_SHARED_KDUPDATER
# define KDTOOLS_UPDATER_EXPORT Q_DECL_EXPORT
# else
# define KDTOOLS_UPDATER_EXPORT Q_DECL_IMPORT
# endif
#else // KDTOOLS_SHARED
# define KDTOOLSCORE_EXPORT
# define KDTOOLSGUI_EXPORT
# define KDTOOLSXML_EXPORT
# define KDTOOLS_UPDATER_EXPORT
#endif // KDTOOLS_SHARED
#define MAKEINCLUDES_EXPORT
#define DOXYGEN_PROPERTY( x )
#ifdef DOXYGEN_RUN
# define KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( func ) operator unspecified_bool_type() const { return func; }
# define KDAB_USING_SAFE_BOOL_OPERATOR( Class ) operator unspecified_bool_type() const;
#else
# define KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( func ) \
private: \
struct __safe_bool_dummy__ { void nonnull() {} }; \
public: \
typedef void ( __safe_bool_dummy__::*unspecified_bool_type )(); \
operator unspecified_bool_type() const { \
return ( func ) ? &__safe_bool_dummy__::nonnull : 0 ; \
}
#define KDAB_USING_SAFE_BOOL_OPERATOR( Class ) \
using Class::operator Class::unspecified_bool_type;
#endif
#define KDTOOLS_MAKE_RELATION_OPERATORS( Class, linkage ) \
linkage bool operator>( const Class & lhs, const Class & rhs ) { \
return operator<( rhs, lhs ); \
} \
linkage bool operator!=( const Class & lhs, const Class & rhs ) { \
return !operator==( lhs, rhs ); \
} \
linkage bool operator<=( const Class & lhs, const Class & rhs ) { \
return !operator>( lhs, rhs ); \
} \
linkage bool operator>=( const Class & lhs, const Class & rhs ) { \
return !operator<( lhs, rhs ); \
}
template <typename T>
inline T & __kdtools__dereference_for_methodcall( T & o ) {
return o;
}
template <typename T>
inline T & __kdtools__dereference_for_methodcall( T * o ) {
return *o;
}
#define KDAB_SET_OBJECT_NAME( x ) __kdtools__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
KDTOOLSCORE_EXPORT bool _kdCheckQtVersion_impl( unsigned int major, unsigned int minor=0, unsigned int patchlevel=0 );
static inline bool kdCheckQtVersion( unsigned int major, unsigned int minor=0, unsigned int patchlevel=0 ) {
return (major<<16|minor<<8|patchlevel) <= static_cast<unsigned int>(QT_VERSION)
|| _kdCheckQtVersion_impl( major, minor, patchlevel );
}
#define KDTOOLS_DECLARE_PRIVATE_BASE( Class ) \
protected: \
class Private; \
Private * d_func() { return _d; } \
const Private * d_func() const { return _d; } \
Class( Private * _d_, bool b ) : _d( _d_ ) { init(b); } \
private: \
void init(bool); \
private: \
Private * _d
#define KDTOOLS_DECLARE_PRIVATE_DERIVED( Class, Base ) \
protected: \
class Private; \
Private * d_func() { \
return reinterpret_cast<Private*>( Base::d_func() ); \
} \
const Private * d_func() const { \
return reinterpret_cast<const Private*>( Base::d_func() ); \
} \
Class( Private * _d_, bool b ) \
: Base( reinterpret_cast<Base::Private*>(_d_), b ) { init(b); } \
private: \
void init(bool)
#endif /* KDTOOLS_KDTOOLSGLOBAL_H */

View File

@ -1,209 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#include "pimpl_ptr.h"
/*!
\class pimpl_ptr:
\ingroup core smartptr
\brief Owning pointer for private implementations
\since_c 2.1
(The exception safety of this class has not been evaluated yet.)
pimpl_ptr is a smart immutable pointer, which owns the contained object. Unlike other smart pointers,
it creates a standard constructed object when instanciated via the
\link pimpl_ptr() standard constructor\endlink.
Additionally, pimpl_ptr respects constness of the pointer object and returns \c const \c T* for
a const pimpl_ptr object.
The content of a pimpl_ptr cannot be changed during it's lifetime.
\section general-use General Use
The general use case of pimpl_ptr is the "Pimpl Idiom", i.e. hiding the private implementation of a class
from the user's compiler which see \c MyClass as
\code
class MyClass
{
public:
MyClass();
~MyClass();
// public class API
int value() const;
private:
class Private; // defined later
kdtools::pimpl_ptr< Private > d;
};
\endcode
but not the private parts of it. These can only be seen (and accessed) by the code knowing \c MyClass::Private:
\code
class MyClass::Private
{
public:
int value;
};
MyClass::MyClass()
{
// d was automatically filled with new Private
d->value = 42;
}
MyClass::~MyClass()
{
// the content of d gets deleted automatically
}
int MyClass::value() const
{
// access the private part:
// since MyClass::value() is const, the returned pointee is const, too
return d->value;
}
\endcode
*/
/*!
\fn pimpl_ptr::pimpl_ptr()
Default constructor. Constructs a pimpl_tr that contains (owns) a standard constructed
instance of \c T.
\post \c *this owns a new object.
*/
/*!
\fn pimpl_ptr::pimpl_ptr( T * t )
Constructor. Constructs a pimpl_ptr that contains (owns) \a t.
\post get() == obj
*/
/*!
\fn pimpl_ptr::~pimpl_ptr()
Destructor.
\post The object previously owned by \c *this has been deleted.
*/
/*!
\fn const T * pimpl_ptr::get() const
\returns a const pointer to the contained (owned) object.
\overload
*/
/*!
\fn T * pimpl_ptr::get()
\returns a pointer to the contained (owned) object.
*/
/*!
\fn const T & pimpl_ptr::operator*() const
Dereference operator. Returns \link get() *get()\endlink.
\overload
*/
/*!
\fn T & pimpl_ptr::operator*()
Dereference operator. Returns \link get() *get()\endlink.
*/
/*!
\fn const T * pimpl_ptr::operator->() const
Member-by-pointer operator. Returns get().
\overload
*/
/*!
\fn T * pimpl_ptr::operator->()
Member-by-pointer operator. Returns get().
*/
#ifdef KDTOOLSCORE_UNITTESTS
#include <kdunittest/test.h>
#include <QObject>
#include <QPointer>
namespace
{
struct ConstTester
{
bool isConst()
{
return false;
}
bool isConst() const
{
return true;
}
};
}
KDAB_UNITTEST_SIMPLE( pimpl_ptr, "kdcoretools" ) {
{
kdtools::pimpl_ptr< QObject > p;
assertNotNull( p.get() );
assertNull( p->parent() );
}
{
QPointer< QObject > o;
{
kdtools::pimpl_ptr< QObject > qobject( new QObject );
o = qobject.get();
assertEqual( o, qobject.operator->() );
assertEqual( o, &(qobject.operator*()) );
}
assertNull( o );
}
{
const kdtools::pimpl_ptr< QObject > qobject( new QObject );
const QObject* o = qobject.get();
assertEqual( o, qobject.operator->() );
assertEqual( o, &(qobject.operator*()) );
}
{
kdtools::pimpl_ptr< QObject > o1;
assertTrue( o1 );
kdtools::pimpl_ptr< QObject > o2( 0 );
assertFalse( o2 );
}
{
const kdtools::pimpl_ptr< ConstTester > o1;
kdtools::pimpl_ptr< ConstTester > o2;
assertTrue( o1->isConst() );
assertFalse( o2->isConst() );
assertTrue( (*o1).isConst() );
assertFalse( (*o2).isConst() );
assertTrue( o1.get()->isConst() );
assertFalse( o2.get()->isConst() );
}
}
#endif // KDTOOLSCORE_UNITTESTS

View File

@ -1,50 +0,0 @@
/*
* SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB.
* SPDX-License-Identifier: LGPL-2.0-only
*
* The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
*/
#ifndef KDTOOLSCORE_PIMPL_PTR_H
#define KDTOOLSCORE_PIMPL_PTR_H
#include "kdtoolsglobal.h"
#ifndef DOXYGEN_RUN
namespace kdtools {
#endif
template <typename T>
class pimpl_ptr {
KDAB_DISABLE_COPY( pimpl_ptr );
T * d;
public:
pimpl_ptr() : d( new T ) {}
explicit pimpl_ptr( T * t ) : d( t ) {}
~pimpl_ptr() { delete d; d = nullptr; }
T * get() { return d; }
const T * get() const { return d; }
T * operator->() { return get(); }
const T * operator->() const { return get(); }
T & operator*() { return *get(); }
const T & operator*() const { return *get(); }
KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( get() )
};
// these are not implemented, so's we can catch their use at
// link-time. Leaving them undeclared would open up a comparison
// via operator unspecified-bool-type().
template <typename T, typename S>
void operator==( const pimpl_ptr<T> &, const pimpl_ptr<S> & );
template <typename T, typename S>
void operator!=( const pimpl_ptr<T> &, const pimpl_ptr<S> & );
#ifndef DOXYGEN_RUN
} // namespace kdtools
#endif
#endif /* KDTOOLSCORE_PIMPL_PTR_H */

View File

@ -13,7 +13,12 @@ This release contains contributions from (alphabetically by first name):
- No external contributors yet
## Core ##
- No core changes yet
- KDE Framework "DBusAddons" is now required, and is used to "activate"
Calamares; the KDAB Single Application Guard is no longer used.
KDSAG needed patching to chase Qt 5.15 deprecations, and the DBus
activation code is tried and tested in Frameworks (tier 1).
Running `calamares -d` no longer enforces a single-application
(it is for debugging purposes, after all).
## Modules ##
- No module changes yet

View File

@ -63,7 +63,6 @@ option( INSTALL_POLKIT "Install Polkit configuration" ON )
option( INSTALL_COMPLETION "Install shell completions" OFF )
# Options for the calamares executable
option( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) # TODO:3.3: WITH->BUILD (this isn't an ABI thing)
option( WITH_KF5DBus "Use DBus service for unique-application." OFF ) # TODO:3.3: WITH->BUILD
# When adding WITH_* that affects the ABI offered by libcalamares,
# also update libcalamares/CalamaresConfig.h.in
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
@ -329,18 +328,19 @@ set_package_properties(
URL "https://api.kde.org/frameworks/kcoreaddons/"
PURPOSE "About Calamares"
)
set_package_properties(
KF5::DBusAddons PROPERTIES
TYPE REQUIRED
DESCRIPTION "Classes for DBus activation"
URL "https://api.kde.org/frameworks/dbusaddons/"
PURPOSE "Unique instance of Calamares"
)
if( NOT KF5Crash_FOUND )
if( WITH_KF5Crash )
message(WARNING "WITH_KF5Crash is set, but KF5::Crash is not available.")
endif()
set( WITH_KF5Crash OFF )
endif()
if( NOT KF5DBusAddons_FOUND )
if( WITH_KF5DBus )
message(WARNING "WITH_KF5DBus is set, but KF5::DBusAddons is not available.")
endif()
set( WITH_KF5DBus OFF )
endif()
# TODO:3.3: Use FindPython3 instead
find_package( PythonInterp ${PYTHONLIBS_VERSION} )
@ -576,7 +576,6 @@ add_feature_info(Python ${WITH_PYTHON} "Python job modules")
add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules")
add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash")
add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus")
### CMake infrastructure installation
#

View File

@ -1,488 +0,0 @@
The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.
You may use, distribute and copy the KD Tools Library under the terms of
GNU Library General Public License version 2, which is displayed below.
-------------------------------------------------------------------------
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 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 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.
GNU LIBRARY GENERAL PUBLIC LICENSE
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 a brief 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 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!

View File

@ -16,17 +16,6 @@ set( calamaresSources
progresstree/ProgressTreeView.cpp
)
if( NOT WITH_KF5DBus )
set( kdsagSources
${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp
${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp
${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdtoolsglobal.cpp
${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
)
mark_thirdparty_code( ${kdsagSources} )
list( APPEND calamaresSources ${kdsagSources} )
endif()
include_directories(
${CMAKE_SOURCE_DIR}/src/libcalamares
${CMAKE_SOURCE_DIR}/src/libcalamaresui
@ -65,15 +54,12 @@ target_link_libraries( calamares_bin
Qt5::Core
Qt5::Widgets
KF5::CoreAddons
KF5::DBusAddons
)
if( WITH_KF5Crash )
target_link_libraries( calamares_bin PRIVATE KF5::Crash )
target_compile_definitions( calamares_bin PRIVATE WITH_KF5Crash )
endif()
if( WITH_KF5DBus )
target_link_libraries( calamares_bin PRIVATE KF5::DBusAddons )
target_compile_definitions( calamares_bin PRIVATE WITH_KF5DBus )
endif()
install( TARGETS calamares_bin
BUNDLE DESTINATION .

View File

@ -16,14 +16,8 @@
#include "utils/Logger.h"
#include "utils/Retranslator.h"
#ifndef WITH_KF5DBus
#include "3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h"
#endif
#include <KCoreAddons/KAboutData>
#ifdef WITH_KF5DBus
#include <KDBusAddons/KDBusService>
#endif
#ifdef WITH_KF5Crash
#include <KCrash/KCrash>
#endif
@ -133,27 +127,7 @@ main( int argc, char* argv[] )
bool is_debug = handle_args( a );
#ifdef WITH_KF5DBus
KDBusService service( is_debug ? KDBusService::Multiple : KDBusService::Unique );
#else
KDSingleApplicationGuard guard( is_debug ? KDSingleApplicationGuard::NoPolicy
: KDSingleApplicationGuard::AutoKillOtherInstances );
if ( !is_debug && !guard.isPrimaryInstance() )
{
// Here we have not yet set-up the logger system, so qDebug() is ok
auto instancelist = guard.instances();
qDebug() << "Calamares is already running, shutting down.";
if ( instancelist.count() > 0 )
{
qDebug() << "Other running Calamares instances:";
}
for ( const auto& i : instancelist )
{
qDebug() << " " << i.isValid() << i.pid() << i.arguments();
}
return 69; // EX_UNAVAILABLE on FreeBSD
}
#endif
Calamares::Settings::init( is_debug );
if ( !Calamares::Settings::instance() || !Calamares::Settings::instance()->isValid() )