Compare commits

..

38 Commits

Author SHA1 Message Date
demmm
cbeeb06e59 Merge pull request #1960 from AIIX/feature/port/partition_qml_module/v1
Initial upload of WIP partitionq module
2022-05-26 21:11:55 +02:00
Aditya Mehra
dc7f91797c fix spdx headers for files 2022-05-26 17:54:42 +09:30
Aditya Mehra
abaf7630ad Add flat partition list module for qml, fix review stuff 2022-05-26 17:47:21 +09:30
Adriaan de Groot
0a4e6804c6 [partition] Move encryption state-calculation to state()
Previously, state() just returned a stored state, which changed
via updateState(). However, when updateState() started taking
visibility-of-the-widget into account, it became possible to
de-sync the *apparent* state of the encryption widget, from the
stored one:
- make an encryption widget, which is not visible
- show it.

Now the stored-state takes visibility into account that is
different (hidden, so we end up with a state of Unconfirmed)
from the apparent value (shown and unchecked).

Move the calculation to state() instead, so whenever queried,
it checks the current checks-and-visibility values. Restore
the previously-reverted bit for accepting LUKS partitions.

SEE #1935
SEE #1953
2022-05-20 18:10:24 +02:00
Adriaan de Groot
900700b9bc [partition] Partial revert reuse-luks merge
- a hidden checkbox should not be handled the same as a checkbox
  that is checked; if there is a setting that can be checked or
  unchecked, it can only be checked when visible.

FIXES #1953
2022-05-20 13:49:32 +02:00
Adriaan de Groot
12b62980cb Changes: pre-release housekeeping 2022-05-20 12:14:05 +02:00
Adriaan de Groot
e7f6ead038 [partition] When changing encryption-widget visibility, re-check next 2022-05-20 12:02:25 +02:00
Adriaan de Groot
51e3ac0ded [partition] Polish up debugging when checking for next-enabled
- Improve the messages a bit
- Remove useless variable (it is checking that the switch(choice)
  statement covers all the cases; let's leave that to the compiler)
2022-05-20 11:56:08 +02:00
Aditya Mehra
a84783d5e2 Initial upload of WIP partitionq module 2022-05-19 17:48:32 +09:30
Adriaan de Groot
17814410e9 [users] always-forbidden-names should be set in the Config constructor 2022-05-18 14:40:35 +02:00
Adriaan de Groot
cebafcf869 [users] Make test more expressive 2022-05-18 14:37:02 +02:00
Adriaan de Groot
7d5a4eafa2 [partition] Support KPMCore3 API (no testPassphrase in FS::luks) 2022-05-18 14:06:00 +02:00
Adriaan de Groot
fc8e5fb5c7 CI: forbid clang-format-14 2022-05-18 12:55:15 +02:00
Adriaan de Groot
f352740aba Git: update blame-ignore 2022-05-18 12:45:32 +02:00
Adriaan de Groot
874a0c1f38 CI: apply coding style globally again 2022-05-18 12:44:55 +02:00
Adriaan de Groot
8fea6f71ab [partition] Apply coding style 2022-05-18 12:26:19 +02:00
Adriaan de Groot
56071c4016 CI: acceptable clang-format versions 2022-05-18 12:22:51 +02:00
Adriaan de Groot
9e664d7165 Changes: pre-release housekeeping 2022-05-18 12:05:45 +02:00
Calamares CI
cf5f0e1caa i18n: [calamares] Automatic merge of Transifex translations 2022-05-18 11:52:43 +02:00
Adriaan de Groot
62f3055e5a [netinstall] Implement a special "blank" item
- If the name of an item is empty, treat it as a
  "separator line", do not paint it like a regular
  item. The branches of the tree just pass it by.
2022-05-18 00:25:04 +02:00
Adriaan de Groot
542aa5c083 SPDX: tag the ignore-revs file, too 2022-05-17 23:29:37 +02:00
Adriaan de Groot
9e2728bcb7 [netinstall] Polish up SPDX headers 2022-05-17 14:40:36 +02:00
Adriaan de Groot
6bf710bed3 [netinstall] Introduce a custom class for the Tree Widget 2022-05-17 14:38:44 +02:00
Adriaan de Groot
67ad12c2d0 Docs: suggest IRC for non-account chat 2022-05-17 11:01:06 +02:00
Adriaan de Groot
4a4d872bb0 Docs: offer alternative Matrix webchat link 2022-05-17 10:51:36 +02:00
Adriaan de Groot
9d6bb2ee2a Merge pull request #1952 from abalfoort/#1935
#1935 - Reuse luks partitions
2022-05-17 10:35:51 +02:00
Adriaan de Groot
a63c474d93 Merge pull request #1948 from dalto8/zfsencryption
[partition] Don't offer whole disk encryption when zfs is selected
2022-05-17 10:31:48 +02:00
abalfoort
f67df577db Fix compilation warning 2022-05-16 15:08:11 +02:00
abalfoort
25a6a5ee53 Fix crypttab 2022-05-16 15:06:59 +02:00
abalfoort
cd4b8d4179 Reuse luks partitions 2022-05-16 15:06:33 +02:00
dalto
31c8123677 [partition] Remove no longer needed setChecked() in the encryption widget 2022-05-14 10:38:27 -05:00
Adriaan de Groot
d318778f53 Merge pull request #1949 from dalto8/removeemits
Remove unneeded emits
2022-05-14 17:24:48 +02:00
dalto
152f99fb07 Remove useless emits 2022-05-13 17:24:07 -05:00
dalto
42841a217c [partition] Don't offer whole disk encryption when zfs is selected 2022-05-13 16:24:15 -05:00
demmm
7937cd625d [localeq]Map.qml needed fixes
esri has several bugs, not showing for all locations, zooming on Americas broken
use osm as default, set preferred, so esri can be fallback
remove Label section for mouse movement, showing coordinates not really useful,
issue with mouse grabbing is back with it
2022-05-13 13:17:19 +02:00
abalfoort
6ef243ba37 Merge branch 'calamares:calamares' into calamares 2022-04-26 14:56:06 +02:00
abalfoort
bbb0efc15e Merge branch 'calamares:calamares' into calamares 2022-04-23 16:14:15 +02:00
abalfoort
34ea3112a5 Merge branch 'calamares' of https://github.com/abalfoort/calamares into calamares 2022-04-23 14:44:06 +02:00
336 changed files with 13928 additions and 3951 deletions

View File

@@ -1,10 +0,0 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
# Gersemi configuration
color: false
definitions: [ CMakeModules/CalamaresAddTest.cmake ]
line_length: 120
quiet: false
unsafe: false

View File

@@ -1 +1,5 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
#
18fef8dfe5d926ec0bc979562553adf4db8db2e9
874a0c1f38b0da4e5bc83083b13a63b1c7eed935

View File

@@ -0,0 +1,488 @@
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

@@ -0,0 +1,481 @@
/*
* 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

@@ -0,0 +1,121 @@
/*
* 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

@@ -0,0 +1,46 @@
/*
* 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

@@ -0,0 +1,42 @@
/*
* 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

@@ -0,0 +1,147 @@
/*
* 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

@@ -0,0 +1,42 @@
/*
* 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

@@ -0,0 +1,120 @@
/*
* 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

@@ -0,0 +1,209 @@
/*
* 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

@@ -0,0 +1,50 @@
/*
* 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 */

284
3rdparty/waitingspinnerwidget.cpp vendored Normal file
View File

@@ -0,0 +1,284 @@
/*
* SPDX-FileCopyrightText: 2012-2014 Alexander Turkin
* SPDX-FileCopyrightText: 2014 William Hallatt
* SPDX-FileCopyrightText: 2015 Jacob Dawid
* SPDX-License-Identifier: MIT
*/
/* Original Work Copyright (c) 2012-2014 Alexander Turkin
Modified 2014 by William Hallatt
Modified 2015 by Jacob Dawid
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Own includes
#include "waitingspinnerwidget.h"
// Standard includes
#include <cmath>
#include <algorithm>
// Qt includes
#include <QPainter>
#include <QTimer>
WaitingSpinnerWidget::WaitingSpinnerWidget(QWidget *parent,
bool centerOnParent,
bool disableParentWhenSpinning)
: QWidget(parent),
_centerOnParent(centerOnParent),
_disableParentWhenSpinning(disableParentWhenSpinning) {
initialize();
}
WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality,
QWidget *parent,
bool centerOnParent,
bool disableParentWhenSpinning)
: QWidget(parent, Qt::Dialog | Qt::FramelessWindowHint),
_centerOnParent(centerOnParent),
_disableParentWhenSpinning(disableParentWhenSpinning){
initialize();
// We need to set the window modality AFTER we've hidden the
// widget for the first time since changing this property while
// the widget is visible has no effect.
setWindowModality(modality);
setAttribute(Qt::WA_TranslucentBackground);
}
void WaitingSpinnerWidget::initialize() {
_color = Qt::black;
_roundness = 100.0;
_minimumTrailOpacity = 3.14159265358979323846;
_trailFadePercentage = 80.0;
_revolutionsPerSecond = 1.57079632679489661923;
_numberOfLines = 20;
_lineLength = 10;
_lineWidth = 2;
_innerRadius = 10;
_currentCounter = 0;
_isSpinning = false;
_timer = new QTimer(this);
connect(_timer, SIGNAL(timeout()), this, SLOT(rotate()));
updateSize();
updateTimer();
hide();
}
void WaitingSpinnerWidget::paintEvent(QPaintEvent *) {
updatePosition();
QPainter painter(this);
painter.fillRect(this->rect(), Qt::transparent);
painter.setRenderHint(QPainter::Antialiasing, true);
if (_currentCounter >= _numberOfLines) {
_currentCounter = 0;
}
painter.setPen(Qt::NoPen);
for (int i = 0; i < _numberOfLines; ++i) {
painter.save();
painter.translate(_innerRadius + _lineLength,
_innerRadius + _lineLength);
qreal rotateAngle =
static_cast<qreal>(360 * i) / static_cast<qreal>(_numberOfLines);
painter.rotate(rotateAngle);
painter.translate(_innerRadius, 0);
int distance =
lineCountDistanceFromPrimary(i, _currentCounter, _numberOfLines);
QColor color =
currentLineColor(distance, _numberOfLines, _trailFadePercentage,
_minimumTrailOpacity, _color);
painter.setBrush(color);
// TODO improve the way rounded rect is painted
painter.drawRoundedRect(
QRect(0, -_lineWidth / 2, _lineLength, _lineWidth), _roundness,
_roundness, Qt::RelativeSize);
painter.restore();
}
}
void WaitingSpinnerWidget::start() {
updatePosition();
_isSpinning = true;
show();
if(parentWidget() && _disableParentWhenSpinning) {
parentWidget()->setEnabled(false);
}
if (!_timer->isActive()) {
_timer->start();
_currentCounter = 0;
}
}
void WaitingSpinnerWidget::stop() {
_isSpinning = false;
hide();
if(parentWidget() && _disableParentWhenSpinning) {
parentWidget()->setEnabled(true);
}
if (_timer->isActive()) {
_timer->stop();
_currentCounter = 0;
}
}
void WaitingSpinnerWidget::setNumberOfLines(int lines) {
_numberOfLines = lines;
_currentCounter = 0;
updateTimer();
}
void WaitingSpinnerWidget::setLineLength(int length) {
_lineLength = length;
updateSize();
}
void WaitingSpinnerWidget::setLineWidth(int width) {
_lineWidth = width;
updateSize();
}
void WaitingSpinnerWidget::setInnerRadius(int radius) {
_innerRadius = radius;
updateSize();
}
QColor WaitingSpinnerWidget::color() {
return _color;
}
qreal WaitingSpinnerWidget::roundness() {
return _roundness;
}
qreal WaitingSpinnerWidget::minimumTrailOpacity() {
return _minimumTrailOpacity;
}
qreal WaitingSpinnerWidget::trailFadePercentage() {
return _trailFadePercentage;
}
qreal WaitingSpinnerWidget::revolutionsPersSecond() {
return _revolutionsPerSecond;
}
int WaitingSpinnerWidget::numberOfLines() {
return _numberOfLines;
}
int WaitingSpinnerWidget::lineLength() {
return _lineLength;
}
int WaitingSpinnerWidget::lineWidth() {
return _lineWidth;
}
int WaitingSpinnerWidget::innerRadius() {
return _innerRadius;
}
bool WaitingSpinnerWidget::isSpinning() const {
return _isSpinning;
}
void WaitingSpinnerWidget::setRoundness(qreal roundness) {
_roundness = std::max(0.0, std::min(100.0, roundness));
}
void WaitingSpinnerWidget::setColor(QColor color) {
_color = color;
}
void WaitingSpinnerWidget::setRevolutionsPerSecond(qreal revolutionsPerSecond) {
_revolutionsPerSecond = revolutionsPerSecond;
updateTimer();
}
void WaitingSpinnerWidget::setTrailFadePercentage(qreal trail) {
_trailFadePercentage = trail;
}
void WaitingSpinnerWidget::setMinimumTrailOpacity(qreal minimumTrailOpacity) {
_minimumTrailOpacity = minimumTrailOpacity;
}
void WaitingSpinnerWidget::rotate() {
++_currentCounter;
if (_currentCounter >= _numberOfLines) {
_currentCounter = 0;
}
update();
}
void WaitingSpinnerWidget::updateSize() {
int size = (_innerRadius + _lineLength) * 2;
setFixedSize(size, size);
}
void WaitingSpinnerWidget::updateTimer() {
_timer->setInterval(1000 / (_numberOfLines * _revolutionsPerSecond));
}
void WaitingSpinnerWidget::updatePosition() {
if (parentWidget() && _centerOnParent) {
move(parentWidget()->width() / 2 - width() / 2,
parentWidget()->height() / 2 - height() / 2);
}
}
int WaitingSpinnerWidget::lineCountDistanceFromPrimary(int current, int primary,
int totalNrOfLines) {
int distance = primary - current;
if (distance < 0) {
distance += totalNrOfLines;
}
return distance;
}
QColor WaitingSpinnerWidget::currentLineColor(int countDistance, int totalNrOfLines,
qreal trailFadePerc, qreal minOpacity,
QColor color) {
if (countDistance == 0) {
return color;
}
const qreal minAlphaF = minOpacity / 100.0;
int distanceThreshold =
static_cast<int>(ceil((totalNrOfLines - 1) * trailFadePerc / 100.0));
if (countDistance > distanceThreshold) {
color.setAlphaF(minAlphaF);
} else {
qreal alphaDiff = color.alphaF() - minAlphaF;
qreal gradient = alphaDiff / static_cast<qreal>(distanceThreshold + 1);
qreal resultAlpha = color.alphaF() - gradient * countDistance;
// If alpha is out of bounds, clip it.
resultAlpha = std::min(1.0, std::max(0.0, resultAlpha));
color.setAlphaF(resultAlpha);
}
return color;
}

122
3rdparty/waitingspinnerwidget.h vendored Normal file
View File

@@ -0,0 +1,122 @@
/*
* SPDX-FileCopyrightText: 2012-2014 Alexander Turkin
* SPDX-FileCopyrightText: 2014 William Hallatt
* SPDX-FileCopyrightText: 2015 Jacob Dawid
* SPDX-License-Identifier: MIT
*/
/* Original Work Copyright (c) 2012-2014 Alexander Turkin
Modified 2014 by William Hallatt
Modified 2015 by Jacob Dawid
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
// Qt includes
#include <QWidget>
#include <QTimer>
#include <QColor>
class WaitingSpinnerWidget : public QWidget {
Q_OBJECT
public:
/*! Constructor for "standard" widget behaviour - use this
* constructor if you wish to, e.g. embed your widget in another. */
WaitingSpinnerWidget(QWidget *parent = nullptr,
bool centerOnParent = true,
bool disableParentWhenSpinning = true);
/*! Constructor - use this constructor to automatically create a modal
* ("blocking") spinner on top of the calling widget/window. If a valid
* parent widget is provided, "centreOnParent" will ensure that
* QtWaitingSpinner automatically centres itself on it, if not,
* "centreOnParent" is ignored. */
WaitingSpinnerWidget(Qt::WindowModality modality,
QWidget *parent = nullptr,
bool centerOnParent = true,
bool disableParentWhenSpinning = true);
public slots:
void start();
void stop();
public:
void setColor(QColor color);
void setRoundness(qreal roundness);
void setMinimumTrailOpacity(qreal minimumTrailOpacity);
void setTrailFadePercentage(qreal trail);
void setRevolutionsPerSecond(qreal revolutionsPerSecond);
void setNumberOfLines(int lines);
void setLineLength(int length);
void setLineWidth(int width);
void setInnerRadius(int radius);
void setText(QString text);
QColor color();
qreal roundness();
qreal minimumTrailOpacity();
qreal trailFadePercentage();
qreal revolutionsPersSecond();
int numberOfLines();
int lineLength();
int lineWidth();
int innerRadius();
bool isSpinning() const;
private slots:
void rotate();
protected:
void paintEvent(QPaintEvent *paintEvent) override;
private:
static int lineCountDistanceFromPrimary(int current, int primary,
int totalNrOfLines);
static QColor currentLineColor(int distance, int totalNrOfLines,
qreal trailFadePerc, qreal minOpacity,
QColor color);
void initialize();
void updateSize();
void updateTimer();
void updatePosition();
private:
QColor _color;
qreal _roundness; // 0..100
qreal _minimumTrailOpacity;
qreal _trailFadePercentage;
qreal _revolutionsPerSecond;
int _numberOfLines;
int _lineLength;
int _lineWidth;
int _innerRadius;
private:
WaitingSpinnerWidget(const WaitingSpinnerWidget&);
WaitingSpinnerWidget& operator=(const WaitingSpinnerWidget&);
QTimer *_timer;
bool _centerOnParent;
bool _disableParentWhenSpinning;
int _currentCounter;
bool _isSpinning;
};

View File

@@ -8,10 +8,19 @@ contributors are listed. Note that Calamares does not have a historical
changelog -- this log starts with version 3.2.0. The release notes on the
website will have to do for older versions.
# 3.2.58 (unreleased) #
# 3.2.58.1 (2022-05-20)
This is a hot-fix release for a regression in the *partition* module where
it was impossible to proceed unless *Encrypt system* was checked.
# 3.2.58 (2022-05-18) #
This release contains contributions from (alphabetically by first name):
- Anke Boersma
- Arjen Balfoort
- Enrique Medina Gremaldos
- Evan James
## Core ##
- Internal improvements to translations-setup means that Catalan (in the
@@ -19,6 +28,13 @@ This release contains contributions from (alphabetically by first name):
are all better supported. Thanks Enrique.
## Modules ##
- *netinstall* Now displays entries with an empty name slightly differently.
An empty name is not generally useful, but in combination with
*immutable:true* and *selected:false* can be used to introduce separators
or descriptive comments into the list of packages.
- *partition* does not offer full-disk encryption when using ZFS. ZFS and the
way Calamares sets up FDE don't mix well. (Thanks Evan)
- *partition* Various bugs related to LUKS have been fixed. (Thanks Arjen)
- *users* module now has a structured *user* key with settings specific
to the user (shell, in particular). This maintains backwards compatibility
with the *userShell* key.

View File

@@ -1,55 +0,0 @@
<!-- SPDX-FileCopyrightText: no
SPDX-License-Identifier: CC0-1.0
-->
This is the changelog for Calamares. For each release, the major changes and
contributors are listed. Note that Calamares does not have a historical
changelog -- this log starts with version 3.3.0. See CHANGES-3.2 for
the history of the 3.2 series (2018-05 - 2021-12).
# 3.3.0 (unreleased) #
This release contains contributions from (alphabetically by first name):
- Anubhav Choudhary
- Evan James
- Vitor Lopes
This is a "minor" version change, but the size of the changes is very
large. Configuration files from previous versions of Calamares will
**certainly** need to be re-validated. Take heed of the many changes
in the *Modules* heading, below.
## Project ##
- The C++ code in the project is now formatted with clang-format 12 or 13,
with the coding-style as found in `.clang-format`; there are minor
differences from the tool, compared to the clang-format 9 usually applied
to Calamares 3.2.
- The CMake code in the project is now formatted with gersemi 0.7.5.
## Core ##
- CMake 3.16, Qt 5.15 are now required; the newer CMake is to support
new features (also for KDE Frameworks), Qt is the current LTS version.
- 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).
- Python 3.6 or later is now required, to allow for F-strings in
Python code and allow other tidy-ups in the Python modules.
Boost::Python now requires 1.67 or later (for CMake support).
- The log file now **always** contains a debug-log, and the `-D` flag
primarily controls what is printed to stdout. By default, stdout
only gets errors; use `-D6` to match stdout with the file. Use `-D8`
to get a verbose log file **and** verbose stdout.
## Modules ##
- *bootloader* now supports more options when building the kernel
command-line. (Thanks Evan)
- *displaymanager* no longer supports the discontinued *kdm* display manager.
- *grubcfg* changed the key *keepDistributor* to *keep_distributor*.
Please update configurations.
- *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later).
- *partition* can now skip installing the bootloader in more scenarios.
#1632 (Thanks Anubhav)

View File

@@ -25,13 +25,10 @@
# CMake once. These affect the ABI offered by Calamares.
# - PYTHON (enable Python Job modules)
# - QML (enable QML UI View modules)
# The WITH_* options affect the ABI of Calamares: you must
# build (C++) modules for Calamares with the same WITH_*
# settings, or they may not load at all.
# - PYTHONQT # TODO:3.3: remove
# BUILD_<foo> : choose additional things to build
# - TESTING (standard CMake option)
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
# - KF5Crash (uses KCrash, rather than Calamares internal, for crash reporting)
# DEBUG_<foo> : special developer flags for debugging
#
# Example usage:
@@ -41,39 +38,35 @@
# One special target is "show-version", which can be built
# to obtain the version number from here.
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
# TODO:3.3: Require CMake 3.12
cmake_minimum_required( VERSION 3.3 FATAL_ERROR )
project( CALAMARES
VERSION 3.2.58.1
LANGUAGES C CXX
)
set(CALAMARES_VERSION 3.3.0)
set(CALAMARES_RELEASE_MODE OFF) # Set to ON during a release
if(CMAKE_SCRIPT_MODE_FILE)
include(${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake)
set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
extend_version( ${CALAMARES_VERSION} OFF _vshort _vlong )
message("${_vlong}")
return()
endif()
project(CALAMARES VERSION ${CALAMARES_VERSION} LANGUAGES C CXX HOMEPAGE_URL "https://calamares.io/")
if(NOT CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Do not build development versions in the source-directory.")
set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development
if( CALAMARES_VERSION_RC EQUAL 1 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
message( FATAL_ERROR "Do not build development versions in the source-directory." )
endif()
### OPTIONS
#
option(INSTALL_CONFIG "Install configuration files" OFF)
option(INSTALL_POLKIT "Install Polkit configuration" ON)
option(INSTALL_COMPLETION "Install shell completions" OFF)
option( INSTALL_CONFIG "Install configuration files" OFF )
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)
option(WITH_QML "Enable QML UI options." ON)
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
option( WITH_PYTHONQT "Enable Python view modules API (deprecated, requires PythonQt)." OFF ) # TODO:3.3: remove
option( WITH_QML "Enable QML UI options." ON )
#
# Additional parts to build that do not affect ABI
option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON)
# Options for the calamares executable
option(BUILD_KF5Crash "Enable crash reporting with KCrash." ON)
# Additional parts to build
option( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON )
# Possible debugging flags are:
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
@@ -84,6 +77,7 @@ option(BUILD_KF5Crash "Enable crash reporting with KCrash." ON)
# - DEBUG_PARTITION_UNSAFE (see partition/CMakeLists.txt)
# - DEBUG_PARTITION_BAIL_OUT (see partition/CMakeLists.txt)
### USE_*
#
# By convention, when there are multiple modules that implement similar
@@ -107,14 +101,15 @@ option(BUILD_KF5Crash "Enable crash reporting with KCrash." ON)
# - *services* picks one of the two service-configuration modules,
# for either systemd or openrc. This defaults to empty so that
# **both** modules are available.
set(USE_services "" CACHE STRING "Select the services module to use")
set( USE_services "" CACHE STRING "Select the services module to use" )
### Calamares application info
#
set(CALAMARES_ORGANIZATION_NAME "Calamares")
set(CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares")
set(CALAMARES_APPLICATION_NAME "Calamares")
set(CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framework")
set( CALAMARES_ORGANIZATION_NAME "Calamares" )
set( CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares" )
set( CALAMARES_APPLICATION_NAME "Calamares" )
set( CALAMARES_DESCRIPTION_SUMMARY
"The distribution-independent installer framework" )
### Transifex (languages) info
#
@@ -140,42 +135,40 @@ set(CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framew
# `txstats.py -e`. See also
#
# Total 74 languages
set( _tx_complete az az_AZ ca es fi_FI he hi hr ja ko lt pt_BR
pt_PT sq sv tr_TR uk zh_TW )
set( _tx_good as be ca@valencia cs_CZ da de fa fr fur it_IT ml nl
ru si sk tg vi zh_CN )
set( _tx_complete az az_AZ ca es fi_FI he hi hr ja lt pt_BR pt_PT
sq sv uk zh_TW )
set( _tx_good as be ca@valencia cs_CZ da de fa fr fur it_IT ko ml
nl ru si sk tg tr_TR vi zh_CN )
set( _tx_ok ar ast bg bn el en_GB es_MX et eu gl hu id is mr nb oc
pl ro sl sr sr@latin th )
set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP
ta_IN te ur zh zh_HK )
# Total 74 languages
### Required versions
#
# See DEPENDENCIES section below.
set(QT_VERSION 5.15.0)
set(YAMLCPP_VERSION 0.5.1)
set(ECM_VERSION 5.18)
set(PYTHONLIBS_VERSION 3.6)
set(BOOSTPYTHON_VERSION 1.72.0)
set( QT_VERSION 5.9.0 )
set( YAMLCPP_VERSION 0.5.1 )
set( ECM_VERSION 5.18 )
set( PYTHONLIBS_VERSION 3.3 )
set( BOOSTPYTHON_VERSION 1.55.0 )
### CMAKE SETUP
#
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" )
# Enable IN_LIST
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
if( POLICY CMP0057 )
cmake_policy( SET CMP0057 NEW )
endif()
# Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files.
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
if( POLICY CMP0071 )
cmake_policy( SET CMP0071 NEW )
endif()
# Recognize more macros to trigger automoc
if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
list(
APPEND
CMAKE_AUTOMOC_MACRO_NAMES
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES
"K_PLUGIN_FACTORY_WITH_JSON"
"K_EXPORT_PLASMA_DATAENGINE_WITH_JSON"
"K_EXPORT_PLASMA_RUNNER"
@@ -183,50 +176,40 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
endif()
# CMake Modules
include(CMakePackageConfigHelpers)
include(CTest)
include(FeatureSummary)
include( CMakePackageConfigHelpers )
include( CTest )
include( FeatureSummary )
# Calamares Modules
include(CMakeColors)
include( CMakeColors )
### C++ SETUP
#
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type" )
set( CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" )
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS_DEBUG "-Og -g")
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
set( CMAKE_C_STANDARD 99 )
set( CMAKE_C_STANDARD_REQUIRED ON )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
set( CMAKE_C_FLAGS_DEBUG "-Og -g" )
set( CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" )
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings")
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings" )
# If no build type is set, pick a reasonable one
if(NOT CMAKE_BUILD_TYPE)
if(CALAMARES_RELEASE_MODE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
else()
set(CMAKE_BUILD_TYPE "Debug")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags.")
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." )
# Clang warnings: doing *everything* is counter-productive, since it warns
# about things which we can't fix (e.g. C++98 incompatibilities, but
# Calamares is C++17).
foreach(
CLANG_WARNINGS
foreach( CLANG_WARNINGS
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
@@ -238,69 +221,68 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wno-documentation-unknown-command
-Wno-unknown-warning-option
)
string(APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}")
string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
endforeach()
# The dwarf-debugging flags are slightly different, too
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf")
string(APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf")
string( APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf" )
string( APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf" )
# Third-party code where we don't care so much about compiler warnings
# (because it's uncomfortable to patch) get different flags; use
# mark_thirdparty_code( <file> [<file>...] )
# to switch off warnings for those sources.
set(SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything")
set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" )
set(CMAKE_TOOLCHAIN_PREFIX "llvm-")
set( CMAKE_TOOLCHAIN_PREFIX "llvm-" )
# The path prefix is only relevant for CMake 3.16 and later, fixes #1286
set(CMAKE_AUTOMOC_PATH_PREFIX OFF)
set(CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h")
set(CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h)
set( CMAKE_AUTOMOC_PATH_PREFIX OFF )
set( CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h" )
set( CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h )
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual" )
set(SUPPRESS_3RDPARTY_WARNINGS "")
set( SUPPRESS_3RDPARTY_WARNINGS "" )
endif()
# Use mark_thirdparty_code() to reduce warnings from the compiler
# on code that we're not going to fix. Call this with a list of files.
macro(mark_thirdparty_code)
set_source_files_properties(
${ARGV}
PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" COMPILE_DEFINITIONS "THIRDPARTY"
set_source_files_properties( ${ARGV}
PROPERTIES
COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}"
COMPILE_DEFINITIONS "THIRDPARTY"
)
endmacro()
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9)
message(STATUS "Found GNU g++ ${CMAKE_CXX_COMPILER_VERSION}, enabling colorized error messages.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto")
if( CMAKE_COMPILER_IS_GNUCXX )
if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR
CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9 )
message( STATUS "Found GNU g++ ${CMAKE_CXX_COMPILER_VERSION}, enabling colorized error messages." )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto" )
endif()
endif()
# API that was deprecated before Qt 5.15 causes a compile error
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
### DEPENDENCIES
#
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core Gui LinguistTools Network Svg Widgets)
if(WITH_QML)
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets)
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core Gui LinguistTools Network Svg Widgets )
if( WITH_QML )
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets )
endif()
# Optional Qt parts
find_package(Qt5DBus CONFIG)
find_package( Qt5DBus CONFIG )
find_package(YAMLCPP ${YAMLCPP_VERSION} REQUIRED)
if(INSTALL_POLKIT)
find_package(PolkitQt5-1 REQUIRED)
find_package( YAMLCPP ${YAMLCPP_VERSION} REQUIRED )
if( INSTALL_POLKIT )
find_package( PolkitQt5-1 REQUIRED )
else()
# Find it anyway, for dependencies-reporting
find_package(PolkitQt5-1)
find_package( PolkitQt5-1 )
endif()
set_package_properties(
PolkitQt5-1
PROPERTIES
PolkitQt5-1 PROPERTIES
DESCRIPTION "Qt5 support for Polkit"
URL "https://cgit.kde.org/polkit-qt-1.git"
PURPOSE "PolkitQt5-1 helps with installing Polkit configuration"
@@ -311,98 +293,115 @@ set_package_properties(
# find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE),
# no need to mess with the module path after.
find_package(ECM ${ECM_VERSION} NO_MODULE)
if(ECM_FOUND)
if( ECM_FOUND )
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
if(BUILD_TESTING)
if ( BUILD_TESTING )
# ECM implies that we can build the tests, too
find_package(Qt5 COMPONENTS Test REQUIRED)
include(ECMAddTests)
find_package( Qt5 COMPONENTS Test REQUIRED )
include( ECMAddTests )
endif()
include(KDEInstallDirs)
endif()
find_package(KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons)
find_package( KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons )
set_package_properties(
KF5::CoreAddons
PROPERTIES
KF5::CoreAddons PROPERTIES
TYPE REQUIRED
DESCRIPTION "Classes built on QtCore for About Data"
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(BUILD_KF5Crash)
message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.")
if( NOT KF5Crash_FOUND )
if( WITH_KF5Crash )
message(WARNING "WITH_KF5Crash is set, but KF5::Crash is not available.")
endif()
set(BUILD_KF5Crash OFF)
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()
find_package(Python ${PYTHONLIBS_VERSION} COMPONENTS Interpreter Development)
# TODO:3.3: Use FindPython3 instead
find_package( PythonInterp ${PYTHONLIBS_VERSION} )
set_package_properties(
Python
PROPERTIES
DESCRIPTION "Python3 interpreter."
PythonInterp PROPERTIES
DESCRIPTION "Python 3 interpreter."
URL "https://python.org"
PURPOSE "Python3 interpreter for certain tests."
PURPOSE "Python 3 interpreter for certain tests."
)
set(_schema_explanation "")
if(Python_Interpreter_FOUND)
if(BUILD_SCHEMA_TESTING)
set( _schema_explanation "" )
if ( PYTHONINTERP_FOUND )
if ( BUILD_SCHEMA_TESTING )
# The configuration validator script has some dependencies,
# and if they are not installed, don't run. If errors out
# with exit(1) on missing dependencies.
if(CALAMARES_CONFIGVALIDATOR_CHECKED)
set(_validator_deps ${CALAMARES_CONFIGVALIDATOR_RESULT})
if ( CALAMARES_CONFIGVALIDATOR_CHECKED )
set( _validator_deps ${CALAMARES_CONFIGVALIDATOR_RESULT} )
else()
exec_program(
${Python_EXECUTABLE}
ARGS
"${CMAKE_SOURCE_DIR}/ci/configvalidator.py"
-x
RETURN_VALUE
_validator_deps
)
set(CALAMARES_CONFIGVALIDATOR_CHECKED TRUE CACHE INTERNAL "Dependencies for configvalidator checked")
set(CALAMARES_CONFIGVALIDATOR_RESULT ${_validator_deps}
CACHE INTERNAL "Result of configvalidator dependency check"
)
exec_program( ${PYTHON_EXECUTABLE} ARGS "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" -x RETURN_VALUE _validator_deps )
set( CALAMARES_CONFIGVALIDATOR_CHECKED TRUE CACHE INTERNAL "Dependencies for configvalidator checked" )
set( CALAMARES_CONFIGVALIDATOR_RESULT ${_validator_deps} CACHE INTERNAL "Result of configvalidator dependency check" )
endif()
# It should never succeed, but only returns 1 when the imports fail
if(_validator_deps EQUAL 1)
set(_schema_explanation " Missing dependencies for configvalidator.py.")
set(BUILD_SCHEMA_TESTING OFF)
if ( _validator_deps EQUAL 1 )
set( _schema_explanation " Missing dependencies for configvalidator.py." )
set( BUILD_SCHEMA_TESTING OFF )
endif()
endif()
else()
# Can't run schema tests without Python3.
set(_schema_explanation " Missing Python3.")
set(BUILD_SCHEMA_TESTING OFF)
set( _schema_explanation " Missing Python3." )
set( BUILD_SCHEMA_TESTING OFF )
endif()
add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}")
add_feature_info( yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}" )
if(Python_Development_FOUND)
find_package(Boost ${BOOSTPYTHON_VERSION} COMPONENTS python)
set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.")
find_package( PythonLibs ${PYTHONLIBS_VERSION} )
set_package_properties(
PythonLibs PROPERTIES
DESCRIPTION "C interface libraries for the Python 3 interpreter."
URL "https://python.org"
PURPOSE "Python 3 is used for Python job modules."
)
if ( PYTHONLIBS_FOUND )
# TODO:3.3: Require Boost + CMake; sort out Boost::Python
# Since Boost provides CMake config files (starting with Boost 1.70.
# or so) the mess that is the Calamares find code picks the wrong
# bits. Suppress those CMake config files, as suggested by @jmrcpn
set(Boost_NO_BOOST_CMAKE ON)
include( BoostPython3 )
find_boost_python3( ${BOOSTPYTHON_VERSION} ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND )
set_package_properties(
Boost PROPERTIES
PURPOSE "Boost.Python is used for Python job modules."
)
# TODO:3.3: Remove PythonQt support
find_package( PythonQt )
set_package_properties( PythonQt PROPERTIES
DESCRIPTION "A Python embedding solution for Qt applications."
URL "http://pythonqt.sourceforge.net"
PURPOSE "PythonQt is used for Python view modules."
)
endif()
if(NOT Python_Development_FOUND OR NOT Boost_FOUND)
if( NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND )
message(STATUS "Disabling Boost::Python modules")
set(WITH_PYTHON OFF)
set( WITH_PYTHON OFF )
endif()
if( NOT PYTHONLIBS_FOUND OR NOT PYTHONQT_FOUND )
message(STATUS "Disabling PythonQt modules")
set( WITH_PYTHONQT OFF )
endif()
# Now we know the state of the ABI-options, copy them into "Calamares_"
# prefixed variables, to match how the variables would-be-named
# when building out-of-tree.
set(Calamares_WITH_PYTHON ${WITH_PYTHON})
set(Calamares_WITH_PYTHONQT ${WITH_PYTHONQT})
set(Calamares_WITH_QML ${WITH_QML})
### Transifex Translation status
@@ -412,39 +411,39 @@ set(Calamares_WITH_QML ${WITH_QML})
# for some obvious error. The actual work of compiling translations
# is done in the lang/ directory.
#
if(Qt5_VERSION VERSION_GREATER 5.12.1)
if( Qt5_VERSION VERSION_GREATER 5.12.1 )
# At least Qt 5.12.2 seems to support Esperanto in QLocale
if("eo" IN_LIST _tx_incomplete)
if( "eo" IN_LIST _tx_incomplete )
message(STATUS "Esperanto support since Qt 5.12.2, enabling Esperanto locale")
list(REMOVE_ITEM _tx_incomplete "eo")
list(APPEND _tx_ok "eo")
list( REMOVE_ITEM _tx_incomplete "eo" )
list( APPEND _tx_ok "eo" )
endif()
endif()
set(curr_tx ${_tx_complete} ${_tx_good} ${_tx_ok} ${_tx_incomplete})
set(tx_errors OFF)
if(curr_tx)
set( curr_tx ${_tx_complete} ${_tx_good} ${_tx_ok} ${_tx_incomplete} )
set( tx_errors OFF )
if ( curr_tx )
# New in list
foreach(l ${curr_tx})
set(p_l "lang/calamares_${l}.ts")
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${p_l})
foreach( l ${curr_tx} )
set( p_l "lang/calamares_${l}.ts" )
if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${p_l} )
message(WARNING "Language ${l} has no .ts file yet.")
set(tx_errors ON)
set( tx_errors ON )
endif()
endforeach()
unset(p_l)
unset(l)
unset( p_l )
unset( l )
endif()
unset(curr_tx)
if(tx_errors)
message(FATAL_ERROR "Translation warnings, see above.")
unset( curr_tx )
if( tx_errors )
message( FATAL_ERROR "Translation warnings, see above." )
endif()
set(CALAMARES_TRANSLATION_LANGUAGES en ${_tx_complete} ${_tx_good} ${_tx_ok})
list(SORT CALAMARES_TRANSLATION_LANGUAGES)
set( CALAMARES_TRANSLATION_LANGUAGES en ${_tx_complete} ${_tx_good} ${_tx_ok} )
list( SORT CALAMARES_TRANSLATION_LANGUAGES )
add_subdirectory(lang) # i18n tools
add_subdirectory( lang ) # i18n tools
### Example Distro
#
@@ -463,22 +462,22 @@ add_subdirectory(lang) # i18n tools
#
# make example-distro
#
find_program(mksquashfs_PROGRAM mksquashfs)
if(mksquashfs_PROGRAM)
set(mksquashfs_FOUND ON)
set(src_fs ${CMAKE_SOURCE_DIR}/data/example-root/)
set(dst_fs ${CMAKE_BINARY_DIR}/example.sqfs)
if(EXISTS ${src_fs})
find_program( mksquashfs_PROGRAM mksquashfs )
if( mksquashfs_PROGRAM )
set( mksquashfs_FOUND ON )
set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ )
set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs )
if( EXISTS ${src_fs} )
# based on the build host. If /lib64 exists, assume it is needed.
# Collect directories needed for a minimal binary distro,
# Note that the last path component is added to the root, so
# if you add /usr/sbin here, it will be put into /sbin_1.
# Add such paths to /etc/profile under ${src_fs}.
set(candidate_fs /sbin /bin /lib /lib64)
set(host_fs "")
foreach(c_fs ${candidate_fs})
if(EXISTS ${c_fs})
list(APPEND host_fs ${c_fs})
set( candidate_fs /sbin /bin /lib /lib64 )
set( host_fs "" )
foreach( c_fs ${candidate_fs} )
if( EXISTS ${c_fs} )
list( APPEND host_fs ${c_fs} )
endif()
endforeach()
add_custom_command(
@@ -489,89 +488,105 @@ if(mksquashfs_PROGRAM)
add_custom_target(example-distro DEPENDS ${dst_fs})
endif()
else()
set(mksquashfs_FOUND OFF)
set( mksquashfs_FOUND OFF )
endif()
# Doesn't list mksquashfs as an optional dep, though, because it
# hasn't been sent through the find_package() scheme.
#
# "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html"
add_feature_info(ExampleDistro ${mksquashfs_FOUND} "Create example-distro target.")
add_feature_info( ExampleDistro ${mksquashfs_FOUND} "Create example-distro target.")
### CALAMARES PROPER
#
set(CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH})
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
# In rare cases we have hotfix-releases with a tweak
if(CALAMARES_VERSION_TWEAK)
set(CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}")
if( CALAMARES_VERSION_TWEAK )
set( CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}" )
endif()
set(CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}")
set( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" )
# Additional info for non-release builds. The "extended" version information
# with date and git information (commit, dirty status) is used only
# by CalamaresVersionX.h, which is included by consumers that need a full
# version number with all that information; normal consumers can include
# CalamaresVersion.h with more stable numbers.
if(NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/")
include(ExtendedVersion)
if( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" )
include( ExtendedVersion )
extend_version( "${CALAMARES_VERSION}" OFF CALAMARES_VERSION_SHORT CALAMARES_VERSION )
endif()
# Special define for RC (e.g. not-a-release) builds.
# This is consumed via the CalamaresConfig.h header.
if(NOT CALAMARES_RELEASE_MODE)
set(CALAMARES_VERSION_RC 1)
# Special target for not-RC (e.g. might-be-release) builds.
# This is used by the release script to get the version.
if ( CALAMARES_VERSION_RC EQUAL 0 )
add_custom_target(show-version
${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT}
USES_TERMINAL
)
endif()
# enforce using constBegin, constEnd for const-iterators
add_definitions(-DQT_STRICT_ITERATORS -DQT_SHARED -DQT_SHAREDPOINTER_TRACK_POINTERS)
add_definitions(
-DQT_STRICT_ITERATORS
-DQT_SHARED
-DQT_SHAREDPOINTER_TRACK_POINTERS
)
# set paths
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# Better default installation paths: GNUInstallDirs defines
# CMAKE_INSTALL_FULL_SYSCONFDIR to be CMAKE_INSTALL_PREFIX/etc by default
# but we really want /etc
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
if( NOT DEFINED CMAKE_INSTALL_SYSCONFDIR )
set( CMAKE_INSTALL_SYSCONFDIR "/etc" )
endif()
# make predefined install dirs available everywhere
include(GNUInstallDirs)
include( GNUInstallDirs )
# This is used by CalamaresAddLibrary; once Calamares is installed,
# the CalamaresConfig.cmake module sets this variable to the IMPORTED
# libraries for Calamares.
set(Calamares_LIBRARIES calamares)
set( Calamares_LIBRARIES calamares )
add_subdirectory(src)
add_subdirectory( src )
add_feature_info(Python ${WITH_PYTHON} "Python job modules")
add_feature_info(Qml ${WITH_QML} "QML UI support")
add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules")
add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
add_feature_info(Polkit ${INSTALL_POLKIT} "Install Polkit files")
add_feature_info(KCrash ${BUILD_KF5Crash} "Crash dumps via KCrash")
add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash")
add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus")
### CMake infrastructure installation
#
#
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files")
set(CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}")
set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
export(PACKAGE Calamares)
export( PACKAGE Calamares )
configure_package_config_file(
"CalamaresConfig.cmake.in"
"${PROJECT_BINARY_DIR}/CalamaresConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_DATADIR
PATH_VARS
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_DATADIR
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(EXPORT Calamares DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" FILE "CalamaresTargets.cmake" NAMESPACE Calamares::)
install(
EXPORT Calamares
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
FILE "CalamaresTargets.cmake"
NAMESPACE Calamares::
)
# Install the cmake files
install(
@@ -588,48 +603,69 @@ install(
"CMakeModules/CalamaresCheckModuleSelection.cmake"
"CMakeModules/CMakeColors.cmake"
"CMakeModules/FindYAMLCPP.cmake"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}"
)
### Miscellaneous installs
#
#
if(INSTALL_CONFIG)
install(FILES settings.conf DESTINATION share/calamares)
if( INSTALL_CONFIG )
install(
FILES settings.conf
DESTINATION share/calamares
)
endif()
if(INSTALL_POLKIT)
install(FILES com.github.calamares.calamares.policy DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}")
if( INSTALL_POLKIT )
install(
FILES com.github.calamares.calamares.policy
DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}"
)
endif()
if(INSTALL_COMPLETION)
if(NOT CMAKE_INSTALL_BASHCOMPLETIONDIR)
set(CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions")
if ( INSTALL_COMPLETION )
if( NOT CMAKE_INSTALL_BASHCOMPLETIONDIR )
set( CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" )
endif()
install(FILES ${CMAKE_SOURCE_DIR}/data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}")
install( FILES ${CMAKE_SOURCE_DIR}/data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}" )
endif()
install(FILES calamares.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(
FILES calamares.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
)
install(FILES man/calamares.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/)
install(
FILES man/calamares.8
DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/
)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE
@ONLY
IMMEDIATE @ONLY
)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
add_custom_target( uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
### CMAKE SUMMARY REPORT
#
get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES)
get_directory_property( SKIPPED_MODULES
DIRECTORY src/modules
DEFINITION LIST_SKIPPED_MODULES
)
calamares_explain_skipped_modules( ${SKIPPED_MODULES} )
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY)
feature_summary(
WHAT DISABLED_FEATURES
DESCRIPTION "The following features have been disabled:"
QUIET_ON_EMPTY
)
feature_summary(
WHAT OPTIONAL_PACKAGES_NOT_FOUND
DESCRIPTION "The following OPTIONAL packages were not found:"
@@ -646,11 +682,11 @@ feature_summary(
#
# Note: most distro's will do distro-specific packaging rather than
# using CPack, and this duplicates information in the AppStream, too.
# TODO:3.3 With newer CMake, move HOMEPAGE_URL to the project()call
set(CPACK_PACKAGE_VENDOR calamares)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Linux system installer")
set(CPACK_PACKAGE_DESCRIPTION
"Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families."
)
set(CPACK_PACKAGE_DESCRIPTION "Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://calamares.io")
set(CPACK_PACKAGE_ICON "data/images/squid.png")
include(CPack)

View File

@@ -0,0 +1,97 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2014 Aurélien Gâteau <agateau@kde.org>
# SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
# SPDX-FileCopyrightText: 2019 Kevin Kofler <kevin.kofler@chello.at>
# SPDX-License-Identifier: BSD-2-Clause
#
###
#
# Handles the mess that Boost::Python is before CMake 3.16 and
# Boost 1.70 or so.
#
###
#
# On Ubuntu 14.04, the libboost-python1.54-dev package comes with one library
# for each Python version:
# libboost_python-py27.so
# libboost_python-py33.so
# libboost_python-py34.so
#
# Boost upstream however installs Boost.Python3 libboost_python3.so, which is
# what FindBoost.cmake is looking for. It looks for a library named
# "libboost_${component}.so".
#
# On Gentoo instead, the >=dev-libs/boost-1.54 package provides boost library
# with a name like:
# libboost_python-2.7.so
# libboost_python-3.3.so
# libboost_python-3.4.so
# depending on what python's targets you selected during install
#
# On Fedora >= 30 instead, the boost-python3-devel provides boost library with a
# name like:
# libboost_python37.so
# depending on what python's targets you selected during install
#
# find_boost_python3() tries to find the package with different component
# names. By default it tries "python3", "python-py$suffix" and
# "python-$dotsuffix", where suffix is based on the `python_version` argument.
# One can supply a custom component name by setting the
# `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time.
set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING
"Name of the Boost.Python component. If Boost.Python is installed as
libboost_python-foo.so then this variable should be set to 'python-foo'."
)
include(FindPackageHandleStandardArgs)
macro( _find_boost_python3_int boost_version componentname found_var )
foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} ${componentname} )
find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} )
string( TOUPPER ${_fbp_name} _fbp_uc_name )
if( Boost_${_fbp_uc_name}_FOUND )
if( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
# No upcasing
set( ${found_var} ${_fbp_name} )
else()
set( ${found_var} ${_fbp_uc_name} )
endif()
break()
endif()
endforeach()
endmacro()
macro( find_boost_python3 boost_version python_version found_var )
set( ${found_var} OFF )
set( _fbp_found OFF )
# turns "3.4.123abc" into "34"
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1\\2" _fbp_python_short_version ${python_version} )
_find_boost_python3_int( ${boost_version} python-py${_fbp_python_short_version} _fbp_found )
if (NOT _fbp_found)
_find_boost_python3_int( ${boost_version} python${_fbp_python_short_version} _fbp_found )
endif()
if (NOT _fbp_found)
# The following loop changes the searched name for Gentoo based distributions
# turns "3.4.123abc" into "3.4"
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1.\\2" _fbp_python_short_version ${python_version} )
_find_boost_python3_int( ${boost_version} python-${_fbp_python_short_version} _fbp_found )
endif()
set( ${found_var} ${_fbp_found} )
# This is superfluous, but allows proper reporting in the features list
if ( _fbp_found )
find_package( Boost ${boost_version} COMPONENTS ${_fbp_found} )
else()
find_package( Boost ${boost_version} COMPONENTS Python )
endif()
set_package_properties(
Boost PROPERTIES
DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3."
URL "http://www.boost.org"
)
endmacro()

View File

@@ -121,8 +121,7 @@ function( _calamares_add_module_subdirectory_impl )
# _mod_testing boolean if the module should be added to the loadmodule tests
file(STRINGS "${_mod_dir}/module.desc" MODULE_INTERFACE REGEX "^interface")
if ( MODULE_INTERFACE MATCHES "pythonqt" )
message( FATAL_ERROR "PythonQt is no longer supported" )
set( _mod_enabled OFF )
set( _mod_enabled ${Calamares_WITH_PYTHONQT} )
set( _mod_reason "No PythonQt support" )
set( _mod_testing OFF )
elseif ( MODULE_INTERFACE MATCHES "python" )

View File

@@ -18,17 +18,19 @@
# SOURCES <FILE..>
# )
include(CMakeParseArguments)
include(CalamaresAutomoc)
include( CMakeParseArguments )
include( CalamaresAutomoc )
function(calamares_add_test name)
set(options GUI)
set(oneValueArgs RESOURCES)
set(multiValueArgs SOURCES LIBRARIES DEFINITIONS)
cmake_parse_arguments(TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(TEST_NAME ${name})
function( calamares_add_test )
# parse arguments (name needs to be saved before passing ARGN into the macro)
set( NAME ${ARGV0} )
set( options GUI )
set( oneValueArgs NAME RESOURCES )
set( multiValueArgs SOURCES LIBRARIES DEFINITIONS )
cmake_parse_arguments( TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set( TEST_NAME ${NAME} )
if(ECM_FOUND AND BUILD_TESTING)
if( ECM_FOUND AND BUILD_TESTING )
ecm_add_test(
${TEST_SOURCES} ${TEST_RESOURCES}
TEST_NAME
@@ -38,18 +40,15 @@ function(calamares_add_test name)
${TEST_LIBRARIES}
Qt5::Core
Qt5::Test
)
)
calamares_automoc( ${TEST_NAME} )
# We specifically pass in the source directory of the test-being-
# compiled, so that it can find test-files in that source dir.
target_compile_definitions(
${TEST_NAME}
PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS}
)
if(TEST_GUI)
target_link_libraries(${TEST_NAME} Calamares::calamaresui Qt5::Gui)
target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS} )
if( TEST_GUI )
target_link_libraries( ${TEST_NAME} Calamares::calamaresui Qt5::Gui )
endif()
if(TEST_RESOURCES)
if( TEST_RESOURCES )
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
endif()
endif()

View File

@@ -0,0 +1,185 @@
# === This file is part of Calamares - <https://calamares.io> ===
#
# SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
# SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
###
#
# Find PythonQt
#
# Sets PYTHONQT_FOUND, PYTHONQT_INCLUDE_DIR, PYTHONQT_LIBRARY, PYTHONQT_LIBRARIES
#
# Also sets PYTHONQT_INCLUDE_DIRS to add whatever directories
# that are needed for extensions.
#
# Python is required
find_package(PythonLibs)
if(NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "error: Python is required to build PythonQt")
endif()
# Cut X.Y[.Z] down to just X.Y
string(REGEX REPLACE
"^([0-9][0-9]*)\.([0-9][0-9]*)"
"\\1.\\2@"
_PYTHONLIBS_MAJMIN
${PYTHONLIBS_VERSION_STRING}
)
string(REGEX REPLACE
"@.*"
""
PYTHONLIBS_MAJMIN
${_PYTHONLIBS_MAJMIN}
)
if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}")
find_path(PYTHONQT_INSTALL_DIR
NAMES
include/PythonQt/PythonQt.h
include/PythonQt5/PythonQt.h
DOC "Directory where PythonQt was installed.")
endif()
# XXX Since PythonQt 3.0 is not yet cmakeified, depending
# on how PythonQt is built, headers will not always be
# installed in "include/PythonQt". That is why "src"
# is added as an option. See [1] for more details.
# [1] https://github.com/commontk/CTK/pull/538#issuecomment-86106367
find_path(PYTHONQT_INCLUDE_DIR PythonQt.h
PATHS
"${PYTHONQT_INSTALL_DIR}/include/PythonQt"
"${PYTHONQT_INSTALL_DIR}/include/PythonQt5"
"${PYTHONQT_INSTALL_DIR}/src"
DOC "Path to the PythonQt include directory")
find_path(PYTHONQT_ALL_INCLUDE_DIR PythonQt_QtAll.h
PATHS
"${PYTHONQT_INCLUDE_DIR}"
"${PYTHONQT_INSTALL_DIR}"
PATH_SUFFIXES
"extensions/PythonQt_QtAll"
"src"
DOC "Path to the PythonQt 'all' header")
if ( NOT PythonQt_FIND_QUIETLY )
message( STATUS "Searching for PythonQt (PythonLibs ${PYTHONLIBS_MAJMIN}) .." )
if ( PYTHONQT_INCLUDE_DIR )
message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" )
message( STATUS " .. found all include ${PYTHONQT_ALL_INCLUDE_DIR}" )
endif()
endif()
# Minimum v3.1 is needed
find_library(PYTHONQT_LIBRARY_RELEASE
NAMES
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt-Qt5-Python3
PythonQt
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "The PythonQt library."
)
find_library(PYTHONQT_LIBRARY_DEBUG
NAMES
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}JMIN${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python3
PythonQt${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt${CMAKE_DEBUG_POSTFIX}
PythonQt
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "The PythonQt library (debug build)."
)
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE
NAMES
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt_QtAll-Qt5-Python3
PythonQt_QtAll
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "Full Qt bindings for the PythonQt library."
)
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG
NAMES
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python3
PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll${CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "Full Qt bindings for the PythonQt library (debug build)."
)
set(PYTHONQT_LIBRARY)
if(PYTHONQT_LIBRARY_RELEASE)
list(APPEND PYTHONQT_LIBRARY optimized ${PYTHONQT_LIBRARY_RELEASE})
endif()
if(PYTHONQT_LIBRARY_DEBUG)
list(APPEND PYTHONQT_LIBRARY debug ${PYTHONQT_LIBRARY_DEBUG})
endif()
set(PYTHONQT_QTALL_LIBRARY)
if(PYTHONQT_QTALL_LIBRARY_RELEASE)
list(APPEND PYTHONQT_QTALL_LIBRARY optimized ${PYTHONQT_QTALL_LIBRARY_RELEASE})
endif()
if(PYTHONQT_QTALL_LIBRARY_DEBUG)
list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG})
endif()
if ( NOT PythonQt_FIND_QUIETLY )
if ( PYTHONQT_LIBRARY )
message( STATUS " .. found library ${PYTHONQT_LIBRARY}" )
endif()
if ( PYTHONQT_QTALL_LIBRARY )
message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" )
endif()
endif()
mark_as_advanced(PYTHONQT_INSTALL_DIR)
mark_as_advanced(PYTHONQT_INCLUDE_DIR)
mark_as_advanced(PYTHONQT_LIBRARY_RELEASE)
mark_as_advanced(PYTHONQT_LIBRARY_DEBUG)
mark_as_advanced(PYTHONQT_QTALL_LIBRARY_RELEASE)
mark_as_advanced(PYTHONQT_QTALL_LIBRARY_DEBUG)
# On linux, also find libutil
if(UNIX AND NOT APPLE)
find_library(PYTHONQT_LIBUTIL util)
mark_as_advanced(PYTHONQT_LIBUTIL)
endif()
# All upper case _FOUND variable is maintained for backwards compatibility.
set(PYTHONQT_FOUND 0)
set(PythonQt_FOUND 0)
if(PYTHONQT_INCLUDE_DIR AND PYTHONQT_LIBRARY AND PYTHONQT_QTALL_LIBRARY)
# Currently CMake'ified PythonQt only supports building against a python Release build.
# This applies independently of CTK build type (Release, Debug, ...)
add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
set(PYTHONQT_FOUND 1)
set(PythonQt_FOUND ${PYTHONQT_FOUND})
set(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARY} ${PYTHONQT_LIBUTIL} ${PYTHONQT_QTALL_LIBRARY})
set(PYTHONQT_INCLUDE_DIRS ${PYTHONQT_INCLUDE_DIR})
if(PYTHONQT_ALL_INCLUDE_DIR)
list(APPEND PYTHONQT_INCLUDE_DIRS ${PYTHONQT_ALL_INCLUDE_DIR})
endif()
elseif(NOT PythonQt_FIND_QUIETLY)
set(_missing "")
if (NOT PYTHONQT_INCLUDE_DIR)
list(APPEND _missing "includes")
endif()
if (NOT PYTHONQT_LIBRARY)
list(APPEND _missing "library")
endif()
if (NOT PYTHONQT_QTALL_LIBRARY)
list(APPEND _missing "qtall")
endif()
message(STATUS "PythonQt not found, missing components ${_missing}")
endif()

View File

@@ -10,7 +10,7 @@
if ( NOT KPMcore_searched_for )
set( KPMcore_searched_for TRUE )
find_package( KPMcore 21.12.0 )
find_package( KPMcore 3.3 )
set_package_properties(
KPMcore PROPERTIES
URL "https://invent.kde.org/kde/kpmcore"
@@ -21,6 +21,18 @@ if ( NOT KPMcore_searched_for )
if( KPMcore_FOUND )
set( KPMcore_API_DEFINITIONS "" )
if( KPMcore_VERSION VERSION_GREATER "3.3.70" AND KPMcore_VERSION VERSION_LESS "4.0" )
message( FATAL_ERROR "KPMCore beta versions ${KPMcore_VERSION} not supported" )
endif()
if ( KPMcore_VERSION VERSION_GREATER "3.3.0")
list( APPEND KPMcore_API_DEFINITIONS WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations
endif()
if ( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0")
list( APPEND KPMcore_API_DEFINITIONS WITH_KPMCORE4API) # kpmcore 4 with new API
endif()
if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.2" )
list( APPEND KPMcore_API_DEFINITIONS WITH_KPMCORE42API) # kpmcore 4.2 with new API
endif()
else()
set( KPMcore_API_DEFINITIONS WITHOUT_KPMcore )
endif()

View File

@@ -77,15 +77,16 @@ instructions are on the wiki.
### Dependencies
Main:
* Compiler with C++17 support
* CMake >= 3.16
* Qt >= 5.15
* Compiler with C++17 support: GCC >= 7 or Clang >= 5
* CMake >= 3.3
* Qt >= 5.9
* yaml-cpp >= 0.5.1
* Python >= 3.6 (required for some modules)
* Boost.Python >= 1.67.0 (required for some modules)
* Python >= 3.3 (required for some modules)
* Boost.Python >= 1.55.0 (required for some modules)
* KDE extra-cmake-modules >= 5.18 (recommended; required for some modules;
required for some tests)
* KDE Frameworks KCoreAddons (>= 5.58 recommended)
* PythonQt (optional, deprecated)
Individual modules may have their own requirements;
these are listed in CMake output.

View File

@@ -87,4 +87,5 @@ include(CalamaresAddPlugin)
# This list should match the one in libcalamares/CalamaresConfig.h,
# which is the C++-language side of the same configuration.
set(Calamares_WITH_PYTHON @WITH_PYTHON@)
set(Calamares_WITH_PYTHONQT @WITH_PYTHONQT@)
set(Calamares_WITH_QML @WITH_QML@)

488
LICENSES/LGPL-2.0-only.txt Normal file
View File

@@ -0,0 +1,488 @@
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

@@ -65,5 +65,5 @@ that chat window open because it can easily take a few hours for
someone to notice a message.
Matrix is persistent, and we'll see your message eventually.
* [![Join us on Matrix](https://img.shields.io/badge/Matrix-%23calamares:kde.org-blue)](https://webchat.kde.org/#/room/%23calamares:kde.org)
* [![Chat on IRC](https://img.shields.io/badge/IRC-Libera.Chat%20%23calamares-green)](https://kiwiirc.com/client/irc.libera.chat/#calamares)
* [![Join us on Matrix](https://img.shields.io/badge/Matrix-%23calamares:kde.org-blue)](https://webchat.kde.org/#/room/%23calamares:kde.org) (needs a Matrix account)
* [![Chat on IRC](https://img.shields.io/badge/IRC-Libera.Chat%20%23calamares-green)](https://kiwiirc.com/client/irc.libera.chat/#calamares) (IRC supports guest accounts)

View File

@@ -1,73 +0,0 @@
#! /bin/sh
#
# SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
# Compares the ABI of the current working tree with the ABI
# from a base-version. Uses libabigail for the actual comparison.
#
# To use the tool, just run the script. It will build Calamares at
# least once, maybe twice (if it needs the base-version ABI information
# and hasn't cached it).
# The base version can be a tag or git-hash; it will be checked-out
# in a worktree.
#
# Note that the hash here now is the very start of 3.3, when ABI
# compatibility was not expected yet at **all**.
BASE_VERSION=419be4df25bc6fcc1958cb6e44afc1b9e64fce71
### Build a tree and cache the ABI info into ci/
#
#
do_build() {
LABEL=$1
SOURCE_DIR=$2
BUILD_DIR=build-abi-$LABEL
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
if ( cd $BUILD_DIR && cmake $SOURCE_DIR -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og -g -gdwarf" -DCMAKE_C_FLAGS="-Og -g -gdwarf" && make -j12 ) > /dev/null 2>&1
then
ls -1 $BUILD_DIR/libcalamares*.so.*
# Copy the un-versioned files; .so is a symlink to the just-built one
for lib in $BUILD_DIR/libcalamares*.so
do
cp $lib ci/`basename $lib`.$LABEL
done
else
echo "! failed to build $LABEL"
exit 1
fi
}
### Build current tree and get ABI info
#
#
do_build current `pwd -P`
### Build ABI base version
#
# We cache this to save on some build time, if we are chasing a
# single branch from an unchanging base version.
#
if test -f ci/libcalamares.so.$BASE_VERSION
then
# The ABI version is cached, so we're good
:
else
git worktree remove --force tree-abi-$BASE_VERSION
git worktree add tree-abi-$BASE_VERSION $BASE_VERSION > /dev/null 2>&1 || { echo "! could not create worktree for $BASE_VERSION" ; exit 1 ; }
do_build $BASE_VERSION $( cd tree-abi-$BASE_VERSION && pwd -P )
fi
### Compare & Report
#
# abidiff compares the Application Binary Interfaces (ABI) of two
# shared libraries in ELF format. It emits a meaningful report describing
# the differences between the two ABIs.
#
# -l prints only the leaf changes, leaving out explanations of why.
#
abidiff -l ci/libcalamares.so.$BASE_VERSION ci/libcalamares.so.current

View File

@@ -24,7 +24,7 @@ test -f "$TOPDIR/.clang-format" || { echo "! No .clang-format support files in $
AS=$( which astyle )
# Allow specifying CF_VERSIONS outside already
CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format-13 clang-format12 clang-format-12 clang-format"
CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format-13 clang-format-13.0.1 clang-format12 clang-format-12 clang-format"
for _cf in $CF_VERSIONS
do
# Not an error if this particular clang-format isn't found
@@ -42,14 +42,17 @@ test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; }
# Version 7 and earlier doesn't understand all the options we would like
# Version 12 handles lambdas nicely, so use that.
# Version 13 is also ok.
# Version 14 behaves differently with short-functions-in-class,
# spreading functions out that 13 keeps on one line. To avoid
# ping-pong commits, forbid 14.
format_version=`"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1`
case "$format_version" in
12|13|14 )
12|13 )
:
;;
* )
echo "! Clang-format version '$format_version' unsupported, version 12-14 required."
echo "! Clang-format version '$format_version' unsupported, versions 12 or 13 are ok."
exit 1
;;
esac

View File

@@ -97,12 +97,10 @@ class EditingOutputter(object):
lines = f.readlines()
mark = None
mark_text = None
for l in lines:
# Note that we didn't strip the lines, so need the \n here
if l.startswith("# Total ") and l.endswith(" languages\n"):
mark = lines.index(l)
mark_text = l
break
if mark is None:
raise TXError("No CMakeLists.txt lines for TX stats found")
@@ -110,17 +108,18 @@ class EditingOutputter(object):
nextmark = mark + 1
for l in lines[mark+1:]:
nextmark += 1
if l.startswith(mark_text):
break
if nextmark > mark + 100 or nextmark > len(lines) - 4:
if l.startswith("set( _tx_"):
nextmark += 1
continue
if l.startswith(" "):
nextmark += 1
continue
break
if nextmark > mark + 12 or nextmark > len(lines) - 4:
# Try to catch runaway nextmarks: we know there should
# be four set-lines, which are unlikely to be 3 lines each;
# similarly the CMakeLists.txt is supposed to end with
# some boilerplate.
#
# However, gersemi will reformat to one-language-per-line,
# so we can get really long sections, that's why we use 100 as a limit.
raise TXError("Could not find end of TX settings in CMakeLists.txt")
self.post_lines = lines[nextmark:]
@@ -186,8 +185,7 @@ def get_tx_stats(languages, outputter, verbose):
)
all_langs = []
mark_text = "# Total %d languages" % len(languages)
outputter.print(mark_text)
outputter.print("# Total %d languages" % len(languages))
for lang_name in languages:
stats = languages[lang_name]["translated"]["percentage"]
# Make the by-definition-incomplete languages have a percentage
@@ -204,7 +202,6 @@ def get_tx_stats(languages, outputter, verbose):
output_langs(all_langs, outputter, "good", lambda s : 1.0 > s >= 0.75)
output_langs(all_langs, outputter, "ok", lambda s : 0.75 > s >= 0.05)
output_langs(all_langs, outputter, "incomplete", lambda s : 0.05 > s)
outputter.print(mark_text)
# Audit the languages that are in TX, mapped to git
for lang_name in languages:

View File

@@ -13,15 +13,15 @@
# - defines an OBJECT LIBRARY calamares-i18n for linking the compiled
# translations into an executable.
include(CalamaresAddTranslations)
include( CalamaresAddTranslations )
find_package(Qt5 COMPONENTS Xml)
if(Qt5Xml_FOUND)
if( Qt5Xml_FOUND )
add_executable(txload txload.cpp)
target_link_libraries(txload Qt5::Xml)
endif()
install_calamares_gettext_translations(python
install_calamares_gettext_translations( python
SOURCE_DIR ${CMAKE_SOURCE_DIR}/lang/python
FILENAME python.mo
RENAME calamares-python.mo
@@ -30,25 +30,25 @@ install_calamares_gettext_translations(python
### TRANSLATIONS
#
#
set(TS_FILES "")
set(calamares_i18n_qrc_content "")
set( TS_FILES "" )
set( calamares_i18n_qrc_content "" )
# calamares and qt language files
foreach(lang ${CALAMARES_TRANSLATION_LANGUAGES})
foreach(tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}")
if(EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts")
string(APPEND calamares_i18n_qrc_content "<file>${tlsource}.qm</file>\n")
list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts")
foreach( lang ${CALAMARES_TRANSLATION_LANGUAGES} )
foreach( tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}" )
if( EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" )
string( APPEND calamares_i18n_qrc_content "<file>${tlsource}.qm</file>\n" )
list( APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" )
endif()
endforeach()
endforeach()
set(trans_file calamares_i18n)
set(trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc)
set(trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx)
set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile})
set( trans_file calamares_i18n )
set( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc )
set( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx )
set( CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile} )
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY)
configure_file( ${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY )
qt5_add_translation(QM_FILES ${TS_FILES})

View File

@@ -37,17 +37,17 @@
<message>
<location filename="../src/modules/partition/core/BootLoaderModel.cpp" line="92"/>
<source>Boot Partition</source>
<translation type="unfinished"/>
<translation>Particion daviada</translation>
</message>
<message>
<location filename="../src/modules/partition/core/BootLoaderModel.cpp" line="99"/>
<source>System Partition</source>
<translation type="unfinished"/>
<translation>Particion sistèma</translation>
</message>
<message>
<location filename="../src/modules/partition/core/BootLoaderModel.cpp" line="129"/>
<source>Do not install a boot loader</source>
<translation type="unfinished"/>
<translation>Installar pas lo gestionari d'aviada</translation>
</message>
<message>
<location filename="../src/modules/partition/core/BootLoaderModel.cpp" line="147"/>
@@ -83,12 +83,12 @@
<message>
<location filename="../src/calamares/DebugWindow.ui" line="48"/>
<source>Modules</source>
<translation type="unfinished"/>
<translation>Moduls</translation>
</message>
<message>
<location filename="../src/calamares/DebugWindow.ui" line="61"/>
<source>Type:</source>
<translation type="unfinished"/>
<translation>Tipe:</translation>
</message>
<message>
<location filename="../src/calamares/DebugWindow.ui" line="68"/>
@@ -124,7 +124,7 @@
<message>
<location filename="../src/calamares/DebugWindow.ui" line="118"/>
<source>Reload Stylesheet</source>
<translation type="unfinished"/>
<translation>Recargar fuèlh destil</translation>
</message>
<message>
<location filename="../src/calamares/DebugWindow.ui" line="128"/>
@@ -139,7 +139,7 @@
<message>
<location filename="../src/calamares/DebugWindow.cpp" line="221"/>
<source>Debug information</source>
<translation type="unfinished"/>
<translation>Informacions de desbugatge</translation>
</message>
</context>
<context>
@@ -194,12 +194,12 @@
<message>
<location filename="../src/libcalamares/ProcessJob.cpp" line="42"/>
<source> Run command '%1'.</source>
<translation type="unfinished"/>
<translation>Executar la comanda « %1».</translation>
</message>
<message>
<location filename="../src/libcalamares/ProcessJob.cpp" line="49"/>
<source>Running command %1 %2</source>
<translation type="unfinished"/>
<translation>Execucion de la comanda %1 %2</translation>
</message>
</context>
<context>
@@ -207,7 +207,7 @@
<message>
<location filename="../src/libcalamares/PythonJob.cpp" line="233"/>
<source>Running %1 operation.</source>
<translation type="unfinished"/>
<translation>Execucion de loperacion %1</translation>
</message>
<message>
<location filename="../src/libcalamares/PythonJob.cpp" line="262"/>
@@ -250,7 +250,7 @@
<message>
<location filename="../src/libcalamaresui/viewpages/QmlViewStep.cpp" line="268"/>
<source>Loading failed.</source>
<translation type="unfinished"/>
<translation>Fracàs del cargament.</translation>
</message>
</context>
<context>
@@ -336,7 +336,7 @@ Link copied to clipboard</source>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="189"/>
<source>Calamares Initialization Failed</source>
<translation type="unfinished"/>
<translation>Lançament de Calamares fracassat</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="190"/>
@@ -396,22 +396,22 @@ Link copied to clipboard</source>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="378"/>
<source>Setup is complete. Close the setup program.</source>
<translation type="unfinished"/>
<translation>Configuracion acabada. Tampatz lo programa de configuracion.</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="379"/>
<source>The installation is complete. Close the installer.</source>
<translation type="unfinished"/>
<translation>Linstallacion es acabada. Tampatz linstallador.</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="381"/>
<source>Cancel setup without changing the system.</source>
<translation type="unfinished"/>
<translation>Anullar la configuracion sens cambiar lo sistèma.</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="382"/>
<source>Cancel installation without changing the system.</source>
<translation type="unfinished"/>
<translation>Anullar linstallacion sens cambiar lo sistèma.</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="392"/>
@@ -436,12 +436,12 @@ Link copied to clipboard</source>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="495"/>
<source>Cancel setup?</source>
<translation type="unfinished"/>
<translation>Anullar la configuracion?</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="495"/>
<source>Cancel installation?</source>
<translation type="unfinished"/>
<translation>Anullar linstallacion?</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="496"/>
@@ -489,7 +489,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/calamares/CalamaresWindow.cpp" line="371"/>
<source>%1 Installer</source>
<translation type="unfinished"/>
<translation>Installador de %1</translation>
</message>
</context>
<context>
@@ -536,12 +536,12 @@ The installer will quit and all changes will be lost.</source>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1062"/>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1159"/>
<source>Current:</source>
<translation type="unfinished"/>
<translation>Actual:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="139"/>
<source>After:</source>
<translation type="unfinished"/>
<translation>Aprèp:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1723"/>
@@ -566,12 +566,12 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1091"/>
<source>Boot loader location:</source>
<translation type="unfinished"/>
<translation>Emplaçament del gestionari d'aviada:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1150"/>
<source>&lt;strong&gt;Select a partition to install on&lt;/strong&gt;</source>
<translation type="unfinished"/>
<translation>&lt;strong&gt;Seleccionar una particion ont installar&lt;/strong&gt;</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1209"/>
@@ -586,7 +586,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1225"/>
<source>EFI system partition:</source>
<translation type="unfinished"/>
<translation>Particion sistèma EFI:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/ChoicePage.cpp" line="1385"/>
@@ -803,7 +803,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/netinstall/Config.cpp" line="77"/>
<source>Package selection</source>
<translation type="unfinished"/>
<translation>Seleccion dels paquets</translation>
</message>
<message>
<location filename="../src/modules/netinstall/Config.cpp" line="59"/>
@@ -838,72 +838,72 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/welcome/Config.cpp" line="250"/>
<source>&lt;h1&gt;Welcome to the Calamares setup program for %1&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda al programa dinstallacion de Calamares per %1&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/Config.cpp" line="251"/>
<source>&lt;h1&gt;Welcome to %1 setup&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda a la configuracion de %1&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/Config.cpp" line="255"/>
<source>&lt;h1&gt;Welcome to the Calamares installer for %1&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda a linstallador de Calamares per %1&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/Config.cpp" line="256"/>
<source>&lt;h1&gt;Welcome to the %1 installer&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda a linstallador de %1&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="221"/>
<source>Your username is too long.</source>
<translation type="unfinished"/>
<translation>Vòstre nom dutilizaire es tròp long.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="227"/>
<source>'%1' is not allowed as username.</source>
<translation type="unfinished"/>
<translation>« %1» es pas permés coma nom dutilizaire.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="234"/>
<source>Your username must start with a lowercase letter or underscore.</source>
<translation type="unfinished"/>
<translation>Vòstre nom dutilizaire deu començar per una minuscula o un jonhent bas.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="238"/>
<source>Only lowercase letters, numbers, underscore and hyphen are allowed.</source>
<translation type="unfinished"/>
<translation>Son solament permeses las letras minusculas, nombres, jonhents basses e los tirets.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="288"/>
<source>Your hostname is too short.</source>
<translation type="unfinished"/>
<translation>Vòstre nom dòste es tròp cort.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="292"/>
<source>Your hostname is too long.</source>
<translation type="unfinished"/>
<translation>Vòstre nom dòste es tròp long.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="298"/>
<source>'%1' is not allowed as hostname.</source>
<translation type="unfinished"/>
<translation>« %1» es pas permés coma nom dòste.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="304"/>
<source>Only letters, numbers, underscore and hyphen are allowed.</source>
<translation type="unfinished"/>
<translation>Son solament permeses las letras, nombres, jonhents basses e los tirets.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="573"/>
<source>Your passwords do not match!</source>
<translation type="unfinished"/>
<translation>Los senhals correspondon pas!</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="587"/>
<source>OK!</source>
<translation type="unfinished"/>
<translation>Dacòrd!</translation>
</message>
<message>
<location filename="../src/modules/finished/Config.cpp" line="145"/>
@@ -928,27 +928,27 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/finished/Config.cpp" line="152"/>
<source>Setup Complete</source>
<translation type="unfinished"/>
<translation>Configuracion acabada</translation>
</message>
<message>
<location filename="../src/modules/finished/Config.cpp" line="153"/>
<source>Installation Complete</source>
<translation type="unfinished"/>
<translation>Installacion acabada</translation>
</message>
<message>
<location filename="../src/modules/finished/Config.cpp" line="154"/>
<source>The setup of %1 is complete.</source>
<translation type="unfinished"/>
<translation>La configuracion de %1 es acabada.</translation>
</message>
<message>
<location filename="../src/modules/finished/Config.cpp" line="155"/>
<source>The installation of %1 is complete.</source>
<translation type="unfinished"/>
<translation>Linstallacion de %1 es acabada.</translation>
</message>
<message>
<location filename="../src/modules/packagechooser/Config.cpp" line="111"/>
<source>Package Selection</source>
<translation type="unfinished"/>
<translation>Seleccion dels paquets</translation>
</message>
<message>
<location filename="../src/modules/packagechooser/Config.cpp" line="113"/>
@@ -999,7 +999,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="42"/>
<source>Si&amp;ze:</source>
<translation type="unfinished"/>
<translation>Ta&amp;lha:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="52"/>
@@ -1009,7 +1009,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="59"/>
<source>Partition &amp;Type:</source>
<translation type="unfinished"/>
<translation>&amp;Tipe de particion:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="71"/>
@@ -1019,12 +1019,12 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="81"/>
<source>E&amp;xtended</source>
<translation type="unfinished"/>
<translation>E&amp;spandida</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="123"/>
<source>Fi&amp;le System:</source>
<translation type="unfinished"/>
<translation>Sistèma de fic&amp;hièr:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="155"/>
@@ -1034,7 +1034,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="165"/>
<source>&amp;Mount Point:</source>
<translation type="unfinished"/>
<translation>Punt de &amp;montatge:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="191"/>
@@ -1182,17 +1182,17 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/CreateUserJob.cpp" line="35"/>
<source>Create user %1</source>
<translation type="unfinished"/>
<translation>Crear lutilizaire %1</translation>
</message>
<message>
<location filename="../src/modules/users/CreateUserJob.cpp" line="42"/>
<source>Create user &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>Crear utilizaire &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/users/CreateUserJob.cpp" line="125"/>
<source>Preserving home directory</source>
<translation type="unfinished"/>
<translation>Servar lo repertòri home</translation>
</message>
<message>
<location filename="../src/modules/users/CreateUserJob.cpp" line="49"/>
@@ -1266,7 +1266,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/jobs/DeletePartitionJob.cpp" line="73"/>
<source>Delete partition %1.</source>
<translation type="unfinished"/>
<translation>Suprimir la particion %1.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/DeletePartitionJob.cpp" line="80"/>
@@ -1276,7 +1276,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/jobs/DeletePartitionJob.cpp" line="87"/>
<source>Deleting partition %1.</source>
<translation type="unfinished"/>
<translation>Supression de la particion %1.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/DeletePartitionJob.cpp" line="102"/>
@@ -1388,12 +1388,12 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="103"/>
<source>&amp;Mount Point:</source>
<translation type="unfinished"/>
<translation>Punt de &amp;montatge:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="129"/>
<source>Si&amp;ze:</source>
<translation type="unfinished"/>
<translation>Ta&amp;lha:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="139"/>
@@ -1403,7 +1403,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="146"/>
<source>Fi&amp;le System:</source>
<translation type="unfinished"/>
<translation>Sistèma de fic&amp;hièr:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="159"/>
@@ -1460,7 +1460,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/libcalamaresui/widgets/ErrorDialog.ui" line="40"/>
<source>Details:</source>
<translation type="unfinished"/>
<translation>Detalhs:</translation>
</message>
<message>
<location filename="../src/libcalamaresui/widgets/ErrorDialog.ui" line="56"/>
@@ -1633,22 +1633,22 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/welcome/checker/GeneralRequirements.cpp" line="177"/>
<source>is plugged in to a power source</source>
<translation type="unfinished"/>
<translation>es brancat a una alimentacion electrica</translation>
</message>
<message>
<location filename="../src/modules/welcome/checker/GeneralRequirements.cpp" line="178"/>
<source>The system is not plugged in to a power source.</source>
<translation type="unfinished"/>
<translation>Lo sistèma es pas brancat a una alimentacion electrica.</translation>
</message>
<message>
<location filename="../src/modules/welcome/checker/GeneralRequirements.cpp" line="185"/>
<source>is connected to the Internet</source>
<translation type="unfinished"/>
<translation>es connectat a lInternet</translation>
</message>
<message>
<location filename="../src/modules/welcome/checker/GeneralRequirements.cpp" line="186"/>
<source>The system is not connected to the Internet.</source>
<translation type="unfinished"/>
<translation>Lo sistèma es pas connectat a lInternet.</translation>
</message>
<message>
<location filename="../src/modules/welcome/checker/GeneralRequirements.cpp" line="193"/>
@@ -1736,7 +1736,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="46"/>
<source>Konsole not installed</source>
<translation type="unfinished"/>
<translation>Konsole pas installada</translation>
</message>
<message>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="47"/>
@@ -1778,7 +1778,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="23"/>
<source>System locale setting</source>
<translation type="unfinished"/>
<translation>Paramètres de regionalizacion del sistèma</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="30"/>
@@ -1829,12 +1829,12 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/license/LicensePage.ui" line="26"/>
<source>&lt;h1&gt;License Agreement&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;Acòrd de licéncia&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="135"/>
<source>I accept the terms and conditions above.</source>
<translation type="unfinished"/>
<translation>Accèpti los tèrmes e las condicion aquí dessús.</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="137"/>
@@ -1875,7 +1875,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/license/LicenseWidget.cpp" line="88"/>
<source>URL: %1</source>
<translation type="unfinished"/>
<translation>URL: %1</translation>
</message>
<message>
<location filename="../src/modules/license/LicenseWidget.cpp" line="109"/>
@@ -1912,22 +1912,22 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/license/LicenseWidget.cpp" line="163"/>
<source>File: %1</source>
<translation type="unfinished"/>
<translation>Fichièr: %1</translation>
</message>
<message>
<location filename="../src/modules/license/LicenseWidget.cpp" line="186"/>
<source>Hide license text</source>
<translation type="unfinished"/>
<translation>Amagar lo tèxte de licéncia</translation>
</message>
<message>
<location filename="../src/modules/license/LicenseWidget.cpp" line="186"/>
<source>Show the license text</source>
<translation type="unfinished"/>
<translation>Mostrar lo tèxte de licéncia</translation>
</message>
<message>
<location filename="../src/modules/license/LicenseWidget.cpp" line="190"/>
<source>Open license agreement in browser.</source>
<translation type="unfinished"/>
<translation>Dobrir lacòrd de licéncia dins lo navegador.</translation>
</message>
</context>
<context>
@@ -1935,18 +1935,18 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/locale/LocalePage.cpp" line="130"/>
<source>Region:</source>
<translation type="unfinished"/>
<translation>Region:</translation>
</message>
<message>
<location filename="../src/modules/locale/LocalePage.cpp" line="131"/>
<source>Zone:</source>
<translation type="unfinished"/>
<translation>Zòna;</translation>
</message>
<message>
<location filename="../src/modules/locale/LocalePage.cpp" line="132"/>
<location filename="../src/modules/locale/LocalePage.cpp" line="133"/>
<source>&amp;Change...</source>
<translation type="unfinished"/>
<translation>&amp;Cambiar...</translation>
</message>
</context>
<context>
@@ -2032,7 +2032,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/localeq/Map.qml" line="243"/>
<source>Timezone: %1</source>
<translation type="unfinished"/>
<translation>Fus orari: %1</translation>
</message>
<message>
<location filename="../src/modules/localeq/Map.qml" line="264"/>
@@ -2047,7 +2047,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="49"/>
<source>Package selection</source>
<translation type="unfinished"/>
<translation>Seleccion dels paquets</translation>
</message>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="50"/>
@@ -2067,17 +2067,17 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="53"/>
<source>Browser package</source>
<translation type="unfinished"/>
<translation>Percórrer lo paquet</translation>
</message>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="54"/>
<source>Web browser</source>
<translation type="unfinished"/>
<translation>Navegador web</translation>
</message>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="55"/>
<source>Kernel</source>
<translation type="unfinished"/>
<translation>Nuclèu</translation>
</message>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="56"/>
@@ -2087,7 +2087,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="57"/>
<source>Login</source>
<translation type="unfinished"/>
<translation>Connexion</translation>
</message>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="58"/>
@@ -2127,7 +2127,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="65"/>
<source>Theming</source>
<translation type="unfinished"/>
<translation>Personalizacion</translation>
</message>
<message>
<location filename="../src/modules/netinstall/NetInstallViewStep.cpp" line="66"/>
@@ -2171,7 +2171,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/oemid/OEMViewStep.cpp" line="122"/>
<source>OEM Configuration</source>
<translation type="unfinished"/>
<translation>Configuracion OEM</translation>
</message>
<message>
<location filename="../src/modules/oemid/OEMViewStep.cpp" line="128"/>
@@ -2191,7 +2191,7 @@ The installer will quit and all changes will be lost.</source>
<location filename="../src/modules/localeq/Offline.qml" line="173"/>
<location filename="../src/modules/localeq/Offline.qml" line="217"/>
<source>Timezone: %1</source>
<translation type="unfinished"/>
<translation>Fus orari: %1</translation>
</message>
<message>
<location filename="../src/modules/localeq/Offline.qml" line="115"/>
@@ -2214,17 +2214,17 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="51"/>
<source>Password is too short</source>
<translation type="unfinished"/>
<translation>Lo senhal es tròp cort</translation>
</message>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="67"/>
<source>Password is too long</source>
<translation type="unfinished"/>
<translation>Lo senhal es tròp long</translation>
</message>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="188"/>
<source>Password is too weak</source>
<translation type="unfinished"/>
<translation>Lo senhal es tròp feble</translation>
</message>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="196"/>
@@ -2302,7 +2302,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="249"/>
<source>The password is too short</source>
<translation type="unfinished"/>
<translation>Lo senhal es tròp cort</translation>
</message>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="258"/>
@@ -2421,7 +2421,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="305"/>
<source>Unknown setting - %1</source>
<translation type="unfinished"/>
<translation>Paramètre desconegut - %1</translation>
</message>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="307"/>
@@ -2436,7 +2436,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="313"/>
<source>Bad integer value</source>
<translation type="unfinished"/>
<translation>Marrida valor dentièr</translation>
</message>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="317"/>
@@ -2476,7 +2476,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/CheckPWQuality.cpp" line="333"/>
<source>Unknown error</source>
<translation type="unfinished"/>
<translation>Error desconeguda</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="818"/>
@@ -2509,7 +2509,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/packagechooser/PackageChooserPage.cpp" line="25"/>
<source>Package Selection</source>
<translation type="unfinished"/>
<translation>Seleccion dels paquets</translation>
</message>
<message>
<location filename="../src/modules/packagechooser/PackageChooserPage.cpp" line="26"/>
@@ -2522,7 +2522,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/packagechooserq/PackageChooserQmlViewStep.cpp" line="32"/>
<source>Packages</source>
<translation type="unfinished"/>
<translation>Paquets</translation>
</message>
</context>
<context>
@@ -2530,7 +2530,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/packagechooser/PackageChooserViewStep.cpp" line="51"/>
<source>Packages</source>
<translation type="unfinished"/>
<translation>Paquets</translation>
</message>
</context>
<context>
@@ -2556,7 +2556,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/keyboard/KeyboardPage.ui" line="74"/>
<source>Keyboard Model:</source>
<translation type="unfinished"/>
<translation>Modèl de clavièr:</translation>
</message>
<message>
<location filename="../src/modules/keyboard/KeyboardPage.ui" line="135"/>
@@ -2574,27 +2574,27 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="40"/>
<source>What is your name?</source>
<translation type="unfinished"/>
<translation>Cossí vos dison?</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="55"/>
<source>Your Full Name</source>
<translation type="unfinished"/>
<translation>Vòstre nom complèt</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="124"/>
<source>What name do you want to use to log in?</source>
<translation type="unfinished"/>
<translation>Qual nom volètz utilizar per vos connectar?</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="148"/>
<source>login</source>
<translation type="unfinished"/>
<translation>identificant</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="223"/>
<source>What is the name of this computer?</source>
<translation type="unfinished"/>
<translation>Cossí sapèla aqueste ordenador?</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="247"/>
@@ -2604,7 +2604,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="250"/>
<source>Computer Name</source>
<translation type="unfinished"/>
<translation>Nom de lordenador</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="325"/>
@@ -2671,17 +2671,17 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/PartitionLabelsView.cpp" line="193"/>
<source>Home</source>
<translation type="unfinished"/>
<translation>Home</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/PartitionLabelsView.cpp" line="197"/>
<source>Boot</source>
<translation type="unfinished"/>
<translation>Boot</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/PartitionLabelsView.cpp" line="202"/>
<source>EFI system</source>
<translation type="unfinished"/>
<translation>Sistèma EFI</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/PartitionLabelsView.cpp" line="206"/>
@@ -2696,13 +2696,13 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/gui/PartitionLabelsView.cpp" line="214"/>
<source>New partition</source>
<translation type="unfinished"/>
<translation>Particion novèla</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/PartitionLabelsView.cpp" line="238"/>
<source>%1 %2</source>
<extracomment>size[number] filesystem[name]</extracomment>
<translation type="unfinished"/>
<translation>%1 %2</translation>
</message>
</context>
<context>
@@ -2711,13 +2711,13 @@ The installer will quit and all changes will be lost.</source>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="157"/>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="201"/>
<source>Free Space</source>
<translation type="unfinished"/>
<translation>Espaci disponible</translation>
</message>
<message>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="161"/>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="205"/>
<source>New partition</source>
<translation type="unfinished"/>
<translation>Particion novèla</translation>
</message>
<message>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="298"/>
@@ -2737,7 +2737,7 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="304"/>
<source>Mount Point</source>
<translation type="unfinished"/>
<translation>Punt de montatge</translation>
</message>
<message>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="306"/>
@@ -2853,12 +2853,12 @@ The installer will quit and all changes will be lost.</source>
<message>
<location filename="../src/modules/partition/PartitionViewStep.cpp" line="300"/>
<source>Current:</source>
<translation type="unfinished"/>
<translation>Actual:</translation>
</message>
<message>
<location filename="../src/modules/partition/PartitionViewStep.cpp" line="318"/>
<source>After:</source>
<translation type="unfinished"/>
<translation>Aprèp:</translation>
</message>
<message>
<location filename="../src/modules/partition/PartitionViewStep.cpp" line="529"/>
@@ -3241,7 +3241,7 @@ Output:
<message>
<location filename="../src/modules/partition/gui/ReplaceWidget.cpp" line="277"/>
<source>EFI system partition:</source>
<translation type="unfinished"/>
<translation>Particion sistèma EFI:</translation>
</message>
</context>
<context>
@@ -3425,7 +3425,7 @@ Output:
<location filename="../src/modules/users/SetHostNameJob.cpp" line="124"/>
<location filename="../src/modules/users/SetHostNameJob.cpp" line="131"/>
<source>Internal Error</source>
<translation type="unfinished"/>
<translation>Error intèrna</translation>
</message>
<message>
<location filename="../src/modules/users/SetHostNameJob.cpp" line="142"/>
@@ -4018,22 +4018,22 @@ Output:
<message>
<location filename="../src/modules/welcome/WelcomePage.cpp" line="216"/>
<source>&lt;h1&gt;Welcome to the Calamares setup program for %1.&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda al programa dinstallacion de Calamares per %1.&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/WelcomePage.cpp" line="217"/>
<source>&lt;h1&gt;Welcome to %1 setup.&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda a la configuracion de %1.&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/WelcomePage.cpp" line="222"/>
<source>&lt;h1&gt;Welcome to the Calamares installer for %1.&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda a linstallador de Calamares per %1.&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/WelcomePage.cpp" line="223"/>
<source>&lt;h1&gt;Welcome to the %1 installer.&lt;/h1&gt;</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;La benvenguda a linstallador de %1.&lt;/h1&gt;</translation>
</message>
<message>
<location filename="../src/modules/welcome/WelcomePage.cpp" line="228"/>
@@ -4164,12 +4164,12 @@ Output:
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="65"/>
<source>Close Installer</source>
<translation type="unfinished"/>
<translation>Tampar linstallador</translation>
</message>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="71"/>
<source>Restart System</source>
<translation type="unfinished"/>
<translation>Reaviar lo sistèma</translation>
</message>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="89"/>
@@ -4208,7 +4208,8 @@ Output:
<location filename="../src/modules/localeq/i18n.qml" line="50"/>
<source>&lt;h1&gt;Languages&lt;/h1&gt; &lt;/br&gt;
The system locale setting affects the language and character set for some command line user interface elements. The current setting is &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;Lengas&lt;/h1&gt; &lt;/br&gt;
Los paramètres de lingüistics del sistèma afèctan la lenga, lo jòc de caractèrs per dunes elements dinterfàcias de linha de comanda. Lo parametratge actual es &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/localeq/i18n.qml" line="123"/>
@@ -4232,7 +4233,7 @@ Output:
<message>
<location filename="../src/modules/keyboardq/keyboardq.qml" line="86"/>
<source>Keyboard Model:</source>
<translation type="unfinished"/>
<translation>Modèl de clavièr:</translation>
</message>
<message>
<location filename="../src/modules/keyboardq/keyboardq.qml" line="254"/>
@@ -4349,17 +4350,17 @@ Output:
<message>
<location filename="../src/modules/usersq/usersq.qml" line="56"/>
<source>What is your name?</source>
<translation type="unfinished"/>
<translation>Cossí vos dison?</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="63"/>
<source>Your Full Name</source>
<translation type="unfinished"/>
<translation>Vòstre nom complèt</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="80"/>
<source>What name do you want to use to log in?</source>
<translation type="unfinished"/>
<translation>Qual nom volètz utilizar per vos connectar?</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="87"/>
@@ -4374,7 +4375,7 @@ Output:
<message>
<location filename="../src/modules/usersq/usersq.qml" line="128"/>
<source>Only lowercase letters, numbers, underscore and hyphen are allowed.</source>
<translation type="unfinished"/>
<translation>Son solament permeses las letras, nombres, jonhents basses e los tirets.</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="136"/>
@@ -4384,12 +4385,12 @@ Output:
<message>
<location filename="../src/modules/usersq/usersq.qml" line="145"/>
<source>What is the name of this computer?</source>
<translation type="unfinished"/>
<translation>Cossí sapèla aqueste ordenador?</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="151"/>
<source>Computer Name</source>
<translation type="unfinished"/>
<translation>Nom de lordenador</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="178"/>

View File

@@ -240,7 +240,7 @@
<message>
<location filename="../src/libcalamaresui/viewpages/QmlViewStep.cpp" line="67"/>
<source>Loading ...</source>
<translation type="unfinished"/>
<translation>Ładowanie...</translation>
</message>
<message>
<location filename="../src/libcalamaresui/viewpages/QmlViewStep.cpp" line="88"/>
@@ -360,7 +360,7 @@ Link copied to clipboard</source>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="310"/>
<source>Continue with installation?</source>
<translation type="unfinished"/>
<translation>Kontynuować instalację?</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="312"/>
@@ -502,7 +502,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/jobs/ChangeFilesystemLabelJob.cpp" line="32"/>
<source>Set filesystem label on %1.</source>
<translation type="unfinished"/>
<translation>Ustaw etykietę systemu plików na %1.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/ChangeFilesystemLabelJob.cpp" line="39"/>
@@ -683,7 +683,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/jobs/ClearMountsJob.cpp" line="272"/>
<source>Successfully unmounted %1.</source>
<translation type="unfinished"/>
<translation>Pomyślnie odmontowano %1.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/ClearMountsJob.cpp" line="279"/>
@@ -868,7 +868,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/users/Config.cpp" line="227"/>
<source>'%1' is not allowed as username.</source>
<translation type="unfinished"/>
<translation>'%1' nie może zostać użyte jako nazwa użytkownika.</translation>
</message>
<message>
<location filename="../src/modules/users/Config.cpp" line="234"/>
@@ -908,7 +908,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/users/Config.cpp" line="587"/>
<source>OK!</source>
<translation type="unfinished"/>
<translation>OK!</translation>
</message>
<message>
<location filename="../src/modules/finished/Config.cpp" line="145"/>
@@ -953,7 +953,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/packagechooser/Config.cpp" line="111"/>
<source>Package Selection</source>
<translation type="unfinished"/>
<translation>Wybór Pakietów</translation>
</message>
<message>
<location filename="../src/modules/packagechooser/Config.cpp" line="113"/>
@@ -1049,7 +1049,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="224"/>
<source>Label for the filesystem</source>
<translation type="unfinished"/>
<translation>Etykieta dla systemu plików</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="234"/>
@@ -1084,7 +1084,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/gui/PartitionDialogHelpers.cpp" line="96"/>
<source>Mountpoint must start with a &lt;tt&gt;/&lt;/tt&gt;.</source>
<translation type="unfinished"/>
<translation>Punkt montowania musi się zaczynać od &lt;tt&gt;/&lt;/tt&gt;.</translation>
</message>
</context>
<context>
@@ -1418,7 +1418,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="179"/>
<source>Label for the filesystem</source>
<translation type="unfinished"/>
<translation>Etykieta dla systemu plików</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="189"/>
@@ -2037,7 +2037,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/localeq/Map.qml" line="243"/>
<source>Timezone: %1</source>
<translation type="unfinished"/>
<translation>Strefa czasowa: %1</translation>
</message>
<message>
<location filename="../src/modules/localeq/Map.qml" line="264"/>
@@ -2196,7 +2196,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<location filename="../src/modules/localeq/Offline.qml" line="173"/>
<location filename="../src/modules/localeq/Offline.qml" line="217"/>
<source>Timezone: %1</source>
<translation type="unfinished"/>
<translation>Strefa czasowa: %1</translation>
</message>
<message>
<location filename="../src/modules/localeq/Offline.qml" line="115"/>
@@ -2289,11 +2289,11 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message numerus="yes">
<location filename="../src/modules/users/CheckPWQuality.cpp" line="232"/>
<source>The password contains fewer than %n lowercase letters</source>
<translation type="unfinished">
<numerusform/>
<numerusform/>
<numerusform/>
<numerusform/>
<translation>
<numerusform>Hasło składa się z mniej niż %1 małej litery</numerusform>
<numerusform>Hasło składa się z mniej niż %1 małych liter</numerusform>
<numerusform>Hasło składa się z mniej niż %1 małych liter</numerusform>
<numerusform>Hasło składa się z mniej niż %1 małych liter</numerusform>
</translation>
</message>
<message>
@@ -2504,7 +2504,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/users/Config.cpp" line="818"/>
<source>Password is empty</source>
<translation type="unfinished"/>
<translation>Hasło jest puste</translation>
</message>
</context>
<context>
@@ -2532,7 +2532,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/packagechooser/PackageChooserPage.cpp" line="25"/>
<source>Package Selection</source>
<translation type="unfinished"/>
<translation>Wybór Pakietów</translation>
</message>
<message>
<location filename="../src/modules/packagechooser/PackageChooserPage.cpp" line="26"/>
@@ -2545,7 +2545,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/packagechooserq/PackageChooserQmlViewStep.cpp" line="32"/>
<source>Packages</source>
<translation type="unfinished"/>
<translation>Pakiety</translation>
</message>
</context>
<context>
@@ -2553,7 +2553,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/packagechooser/PackageChooserViewStep.cpp" line="51"/>
<source>Packages</source>
<translation type="unfinished"/>
<translation>Pakiety</translation>
</message>
</context>
<context>
@@ -2602,7 +2602,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="55"/>
<source>Your Full Name</source>
<translation type="unfinished"/>
<translation>Twoja Pełne Imię</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="124"/>
@@ -2612,7 +2612,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="148"/>
<source>login</source>
<translation type="unfinished"/>
<translation>login</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="223"/>
@@ -2627,7 +2627,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="250"/>
<source>Computer Name</source>
<translation type="unfinished"/>
<translation>Nazwa Komputera</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="325"/>
@@ -2644,13 +2644,13 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<location filename="../src/modules/users/page_usersetup.ui" line="355"/>
<location filename="../src/modules/users/page_usersetup.ui" line="525"/>
<source>Password</source>
<translation type="unfinished"/>
<translation>Hasło</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="380"/>
<location filename="../src/modules/users/page_usersetup.ui" line="550"/>
<source>Repeat Password</source>
<translation type="unfinished"/>
<translation>Powtórz Hasło</translation>
</message>
<message>
<location filename="../src/modules/users/page_usersetup.ui" line="455"/>
@@ -2755,7 +2755,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="302"/>
<source>File System Label</source>
<translation type="unfinished"/>
<translation>Etykieta Systemu Plików</translation>
</message>
<message>
<location filename="../src/modules/partition/core/PartitionModel.cpp" line="304"/>
@@ -2901,7 +2901,7 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/partition/PartitionViewStep.cpp" line="549"/>
<source>The filesystem must be mounted on &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>System plików musi zostać zamontowany w &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/PartitionViewStep.cpp" line="555"/>
@@ -3120,7 +3120,7 @@ Wyjście:
<location filename="../src/modules/machineid/Workers.cpp" line="76"/>
<location filename="../src/modules/machineid/Workers.cpp" line="93"/>
<source>File not found</source>
<translation type="unfinished"/>
<translation>Plik nie został znaleziony</translation>
</message>
<message>
<location filename="../src/modules/machineid/Workers.cpp" line="65"/>
@@ -3130,7 +3130,7 @@ Wyjście:
<message>
<location filename="../src/modules/machineid/MachineIdJob.cpp" line="83"/>
<source>Directory not found</source>
<translation type="unfinished"/>
<translation>Katalog nie został znaleziony</translation>
</message>
<message>
<location filename="../src/modules/machineid/MachineIdJob.cpp" line="84"/>
@@ -3922,7 +3922,7 @@ i nie uruchomi się</translation>
<location filename="../src/calamares/VariantModel.cpp" line="232"/>
<source>Key</source>
<comment>Column header for key/value</comment>
<translation type="unfinished"/>
<translation>Klucz</translation>
</message>
<message>
<location filename="../src/calamares/VariantModel.cpp" line="236"/>
@@ -4164,7 +4164,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/welcomeq/about.qml" line="96"/>
<source>Back</source>
<translation type="unfinished"/>
<translation>Wstecz</translation>
</message>
</context>
<context>
@@ -4180,7 +4180,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="36"/>
<source>Installation Completed</source>
<translation type="unfinished"/>
<translation>Instalacja została zakończona</translation>
</message>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="43"/>
@@ -4191,12 +4191,12 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="65"/>
<source>Close Installer</source>
<translation type="unfinished"/>
<translation>Zamknij instalator</translation>
</message>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="71"/>
<source>Restart System</source>
<translation type="unfinished"/>
<translation>Uruchom ponownie system</translation>
</message>
<message>
<location filename="../src/modules/finishedq/finishedq.qml" line="89"/>
@@ -4210,7 +4210,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/finishedq/finishedq@mobile.qml" line="36"/>
<source>Installation Completed</source>
<translation type="unfinished"/>
<translation>Instalacja została zakończona</translation>
</message>
<message>
<location filename="../src/modules/finishedq/finishedq@mobile.qml" line="43"/>
@@ -4246,7 +4246,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/localeq/i18n.qml" line="189"/>
<source>Back</source>
<translation type="unfinished"/>
<translation>Wstecz</translation>
</message>
</context>
<context>
@@ -4363,7 +4363,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/welcomeq/release_notes.qml" line="76"/>
<source>Back</source>
<translation type="unfinished"/>
<translation>Wstecz</translation>
</message>
</context>
<context>
@@ -4381,7 +4381,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="63"/>
<source>Your Full Name</source>
<translation type="unfinished"/>
<translation>Twoja Pełne Imię</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="80"/>
@@ -4416,7 +4416,7 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="151"/>
<source>Computer Name</source>
<translation type="unfinished"/>
<translation>Nazwa Komputera</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="178"/>
@@ -4436,12 +4436,12 @@ i nie uruchomi się</translation>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="217"/>
<source>Password</source>
<translation type="unfinished"/>
<translation>Hasło</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="234"/>
<source>Repeat Password</source>
<translation type="unfinished"/>
<translation>Powtórz Hasło</translation>
</message>
<message>
<location filename="../src/modules/usersq/usersq.qml" line="261"/>

View File

@@ -3,26 +3,26 @@
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: BSD-2-Clause
#
include(CalamaresAddBrandingSubdirectory)
include(CalamaresAddLibrary)
include(CalamaresAddModuleSubdirectory)
include(CalamaresAddPlugin)
include(CalamaresAddTest)
include(CalamaresAddTranslations)
include( CalamaresAddBrandingSubdirectory )
include( CalamaresAddLibrary )
include( CalamaresAddModuleSubdirectory )
include( CalamaresAddPlugin )
include( CalamaresAddTest )
include( CalamaresAddTranslations )
# library
add_subdirectory(libcalamares)
add_subdirectory( libcalamares )
add_subdirectory(libcalamaresui)
add_subdirectory( libcalamaresui )
# all things qml
add_subdirectory(qml/calamares)
add_subdirectory( qml/calamares )
# application
add_subdirectory(calamares)
add_subdirectory( calamares )
# plugins
add_subdirectory(modules)
add_subdirectory( modules )
# branding components
add_subdirectory(branding)
add_subdirectory( branding )

View File

@@ -204,22 +204,3 @@ Adding the subdirectory can be done as follows:
to `.qm` files before being installed. The CMake macro's do this
automatically. For manual packaging, use `lrelease` to compile
the files.
## Global Storage keys
The following keys from the `branding.desc` file are copied into
Global Storage under a *branding* parent key:
"productName",
"version",
"shortVersion",
"versionedName",
"shortVersionedName",
"shortProductName",
"bootloaderEntryName",
"productUrl",
"supportUrl",
"knownIssuesUrl",
"releaseNotesUrl",
"donateUrl"
<!-- see Branding::s_stringEntryStrings and Branding::setGlobals() -->

View File

@@ -4,16 +4,29 @@
# SPDX-License-Identifier: BSD-2-Clause
#
set(calamaresSources
set( calamaresSources
main.cpp
CalamaresApplication.cpp
CalamaresWindow.cpp
DebugWindow.cpp
VariantModel.cpp
progresstree/ProgressTreeDelegate.cpp
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
@@ -29,30 +42,45 @@ include_directories(
# The calamares-i18n.cxx file -- full path in CALAMARES_TRANSLATIONS_SOURCE --
# is created as a target in the lang/ directory. This is compiled to a
# library (it's just the result of a QRC compile).
add_executable(calamares_bin ${calamaresSources} calamares.qrc)
target_include_directories(calamares_bin PRIVATE ${CMAKE_SOURCE_DIR})
set_target_properties(calamares_bin PROPERTIES ENABLE_EXPORTS TRUE RUNTIME_OUTPUT_NAME calamares)
add_executable( calamares_bin ${calamaresSources} calamares.qrc )
target_include_directories( calamares_bin PRIVATE ${CMAKE_SOURCE_DIR} )
set_target_properties(calamares_bin
PROPERTIES
ENABLE_EXPORTS TRUE
RUNTIME_OUTPUT_NAME calamares
)
calamares_automoc( calamares_bin )
calamares_autouic( calamares_bin )
calamares_autorcc( calamares_bin )
if(kdsagSources)
set_source_files_properties(${kdsagSources} PROPERTIES AUTOMOC OFF)
if( kdsagSources )
set_source_files_properties( ${kdsagSources} PROPERTIES AUTOMOC OFF )
endif()
target_link_libraries(
calamares_bin
PRIVATE calamares calamaresui calamares-i18n Qt5::Core Qt5::Widgets KF5::CoreAddons KF5::DBusAddons
target_link_libraries( calamares_bin
PRIVATE
calamares
calamaresui
calamares-i18n
Qt5::Core
Qt5::Widgets
KF5::CoreAddons
)
if(BUILD_KF5Crash)
target_link_libraries(calamares_bin PRIVATE KF5::Crash)
target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash)
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 . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install( TARGETS calamares_bin
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg
install( FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg
RENAME calamares.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps
)
@@ -60,11 +88,11 @@ install(
### TESTS
#
#
if(BUILD_TESTING)
if( BUILD_TESTING )
# Don't install, these are just for enable_testing
add_executable(loadmodule testmain.cpp)
target_link_libraries(loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui)
add_executable( loadmodule testmain.cpp )
target_link_libraries( loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui )
add_executable(test_conf test_conf.cpp)
target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core)
add_executable( test_conf test_conf.cpp )
target_link_libraries( test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core )
endif()

View File

@@ -67,8 +67,7 @@ CalamaresApplication::init()
{
Logger::setupLogfile();
cDebug() << "Calamares version:" << CALAMARES_VERSION;
cDebug() << Logger::SubEntry
<< "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
cDebug() << Logger::SubEntry << "languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).replace( ";", ", " );
if ( !Calamares::Settings::instance() )
{

View File

@@ -19,7 +19,6 @@
#include "Settings.h"
#include "ViewManager.h"
#include "progresstree/ProgressTreeView.h"
#include "translation/Binding.h"
#include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h"
#include "utils/Qml.h"
@@ -135,13 +134,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
{
QPushButton* debugWindowBtn = new QPushButton;
debugWindowBtn->setObjectName( "debugButton" );
CalamaresUtils::Retranslator::attach(
debugWindowBtn,
[ = ]()
{
debugWindowBtn->setText( QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(),
"Show debug information" ) );
} );
CALAMARES_RETRANSLATE_FOR( debugWindowBtn,
debugWindowBtn->setText( QCoreApplication::translate(
CalamaresWindow::staticMetaObject.className(), "Show debug information" ) ); );
sideLayout->addWidget( debugWindowBtn );
debugWindowBtn->setFlat( true );
debugWindowBtn->setCheckable( true );

View File

@@ -23,6 +23,13 @@
#include "utils/Paste.h"
#include "utils/Retranslator.h"
#ifdef WITH_PYTHONQT
#include "ViewManager.h"
#include "viewpages/PythonQtViewStep.h"
#include <gui/PythonQtScriptingConsole.h>
#endif
#include <QSplitter>
#include <QStringListModel>
#include <QTreeView>
@@ -78,17 +85,22 @@ DebugWindow::DebugWindow()
m_ui->globalStorageView->expandAll();
// Do above when the GS changes, too
connect( gs, &GlobalStorage::changed, this, [=] {
m_globals = JobQueue::instance()->globalStorage()->data();
m_globals_model->reload();
m_ui->globalStorageView->expandAll();
} );
connect( gs,
&GlobalStorage::changed,
this,
[ = ]
{
m_globals = JobQueue::instance()->globalStorage()->data();
m_globals_model->reload();
m_ui->globalStorageView->expandAll();
} );
// JobQueue page
m_ui->jobQueueText->setReadOnly( true );
connect( JobQueue::instance(), &JobQueue::queueChanged, this, [this]( const QStringList& jobs ) {
m_ui->jobQueueText->setText( jobs.join( '\n' ) );
} );
connect( JobQueue::instance(),
&JobQueue::queueChanged,
this,
[ this ]( const QStringList& jobs ) { m_ui->jobQueueText->setText( jobs.join( '\n' ) ); } );
// Modules page
QStringList modulesKeys;
@@ -103,10 +115,80 @@ DebugWindow::DebugWindow()
m_ui->moduleConfigView->setModel( m_module_model.get() );
#ifdef WITH_PYTHONQT
QPushButton* pythonConsoleButton = new QPushButton;
pythonConsoleButton->setText( "Attach Python console" );
m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
pythonConsoleButton->hide();
QObject::connect(
pythonConsoleButton,
&QPushButton::clicked,
this,
[ this, moduleConfigModel ]
{
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
if ( module->interface() != Module::Interface::PythonQt || module->type() != Module::Type::View )
return;
for ( ViewStep* step : ViewManager::instance()->viewSteps() )
{
if ( step->moduleInstanceKey() == module->instanceKey() )
{
PythonQtViewStep* pqvs = qobject_cast< PythonQtViewStep* >( step );
if ( pqvs )
{
QWidget* consoleWindow = new QWidget;
QWidget* console = pqvs->createScriptingConsole();
console->setParent( consoleWindow );
QVBoxLayout* layout = new QVBoxLayout;
consoleWindow->setLayout( layout );
layout->addWidget( console );
QHBoxLayout* bottomLayout = new QHBoxLayout;
layout->addLayout( bottomLayout );
QLabel* bottomLabel = new QLabel( consoleWindow );
bottomLayout->addWidget( bottomLabel );
QString line = QString( "Module: <font color=\"#008000\"><code>%1</code></font><br/>"
"Python class: <font color=\"#008000\"><code>%2</code></font>" )
.arg( module->instanceKey() )
.arg( console->property( "classname" ).toString() );
bottomLabel->setText( line );
QPushButton* closeButton = new QPushButton( consoleWindow );
closeButton->setText( "&Close" );
QObject::connect(
closeButton, &QPushButton::clicked, [ consoleWindow ] { consoleWindow->close(); } );
bottomLayout->addWidget( closeButton );
bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
consoleWindow->setParent( this );
consoleWindow->setWindowFlags( Qt::Window );
consoleWindow->setWindowTitle( "Calamares Python console" );
consoleWindow->setAttribute( Qt::WA_DeleteOnClose, true );
consoleWindow->showNormal();
break;
}
}
}
} );
#endif
connect( m_ui->modulesListView->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
[this] {
[ this
#ifdef WITH_PYTHONQT
,
pythonConsoleButton
#endif
]
{
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
Module* module
= ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) );
@@ -117,32 +199,42 @@ DebugWindow::DebugWindow()
m_ui->moduleConfigView->expandAll();
m_ui->moduleTypeLabel->setText( module->typeString() );
m_ui->moduleInterfaceLabel->setText( module->interfaceString() );
#ifdef WITH_PYTHONQT
pythonConsoleButton->setVisible( module->interface() == Module::Interface::PythonQt
&& module->type() == Module::Type::View );
#endif
}
} );
// Tools page
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
connect( m_ui->reloadStylesheetButton, &QPushButton::clicked, []() {
for ( auto* w : qApp->topLevelWidgets() )
{
// Needs to match what's set in CalamaresWindow
if ( w->objectName() == QStringLiteral( "mainApp" ) )
{
w->setStyleSheet( Calamares::Branding::instance()->stylesheet() );
}
}
} );
connect( m_ui->widgetTreeButton, &QPushButton::clicked, []() {
for ( auto* w : qApp->topLevelWidgets() )
{
Logger::CDebug deb;
dumpWidgetTree( deb, w, 0 );
}
} );
connect( m_ui->reloadStylesheetButton,
&QPushButton::clicked,
[]()
{
for ( auto* w : qApp->topLevelWidgets() )
{
// Needs to match what's set in CalamaresWindow
if ( w->objectName() == QStringLiteral( "mainApp" ) )
{
w->setStyleSheet( Calamares::Branding::instance()->stylesheet() );
}
}
} );
connect( m_ui->widgetTreeButton,
&QPushButton::clicked,
[]()
{
for ( auto* w : qApp->topLevelWidgets() )
{
Logger::CDebug deb;
dumpWidgetTree( deb, w, 0 );
}
} );
// Send Log button only if it would be useful
m_ui->sendLogButton->setVisible( CalamaresUtils::Paste::isEnabled() );
connect( m_ui->sendLogButton, &QPushButton::clicked, [this]() { CalamaresUtils::Paste::doLogUploadUI( this ); } );
connect( m_ui->sendLogButton, &QPushButton::clicked, [ this ]() { CalamaresUtils::Paste::doLogUploadUI( this ); } );
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); );
}
@@ -186,11 +278,15 @@ DebugWindowManager::show( bool visible )
{
m_debugWindow = new Calamares::DebugWindow();
m_debugWindow->show();
connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, this, [=]() {
m_debugWindow->deleteLater();
m_visible = false;
emit visibleChanged( false );
} );
connect( m_debugWindow.data(),
&Calamares::DebugWindow::closed,
this,
[ = ]()
{
m_debugWindow->deleteLater();
m_visible = false;
emit visibleChanged( false );
} );
m_visible = true;
emit visibleChanged( true );
}

View File

@@ -5,7 +5,7 @@ SPDX-FileCopyrightText: 2015 Teo Mrnjavac &lt;teo@kde.org&gt;
SPDX-License-Identifier: GPL-3.0-or-later
</author>
<class>Calamares::DebugWindow</class>
<widget class="QWidget" name="DebugWindow">
<widget class="QWidget" name="Calamares::DebugWindow">
<property name="geometry">
<rect>
<x>0</x>

View File

@@ -46,12 +46,12 @@ Rectangle {
Layout.fillWidth: true;
height: 35;
radius: 6;
color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarBackgroundCurrent : Branding.SidebarBackground );
color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarBackgroundSelected : Branding.SidebarBackground );
Text {
anchors.verticalCenter: parent.verticalCenter;
anchors.horizontalCenter: parent.horizontalCenter;
color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarTextCurrent : Branding.SidebarText );
color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarTextSelected : Branding.SidebarText );
text: display;
}
}
@@ -77,7 +77,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter;
x: parent.x + 4;
text: qsTr("Show debug information")
color: Branding.styleString( mouseArea.containsMouse ? Branding.SidebarTextCurrent : Branding.SidebarBackground );
color: Branding.styleString( mouseArea.containsMouse ? Branding.SidebarTextSelect : Branding.SidebarBackground );
font.pointSize : 9
}

View File

@@ -16,9 +16,15 @@
#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>
#ifdef BUILD_KF5Crash
#endif
#ifdef WITH_KF5Crash
#include <KCrash/KCrash>
#endif
@@ -117,16 +123,37 @@ main( int argc, char* argv[] )
KAboutData::setApplicationData( aboutData );
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
#ifdef BUILD_KF5Crash
#ifdef WITH_KF5Crash
KCrash::initialize();
// KCrash::setCrashHandler();
KCrash::setDrKonqiEnabled( true );
KCrash::setFlags( KCrash::SaferDialog | KCrash::AlwaysDirectly );
// TODO: umount anything in /tmp/calamares-... as an emergency save function
#endif
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() )

View File

@@ -25,8 +25,50 @@ item_fontsize()
return CalamaresUtils::defaultFontSize() + 4;
}
static void
paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index )
QSize
ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
if ( !index.isValid() )
{
return option.rect.size();
}
QFont font = qApp->font();
font.setPointSize( item_fontsize() );
QFontMetrics fm( font );
int height = fm.height();
height += 2 * item_margin;
return QSize( option.rect.width(), height );
}
void
ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QStyleOptionViewItem opt = option;
painter->save();
initStyleOption( &opt, index );
opt.text.clear();
painter->setBrush(
QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackground ) ) );
painter->setPen( QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarText ) ) );
paintViewStep( painter, opt, index );
painter->restore();
}
void
ProgressTreeDelegate::paintViewStep( QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index ) const
{
QRect textRect = option.rect.adjusted( item_margin, item_margin, -item_margin, -item_margin );
QFont font = qApp->font();
@@ -36,9 +78,9 @@ paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QMod
if ( index.row() == index.data( Calamares::ViewManager::ProgressTreeItemCurrentIndex ).toInt() )
{
painter->setPen( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextCurrent ) );
painter->setPen( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextSelect ) );
QString textHighlight
= Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackgroundCurrent );
= Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextHighlight );
if ( textHighlight.isEmpty() )
{
painter->setBrush( CalamaresApplication::instance()->mainWindow()->palette().window() );
@@ -80,42 +122,3 @@ paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QMod
}
} while ( shrinkSteps <= maximumShrink );
}
QSize
ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
if ( !index.isValid() )
{
return option.rect.size();
}
QFont font = qApp->font();
font.setPointSize( item_fontsize() );
QFontMetrics fm( font );
int height = fm.height();
height += 2 * item_margin;
return QSize( option.rect.width(), height );
}
void
ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QStyleOptionViewItem opt = option;
painter->save();
initStyleOption( &opt, index );
opt.text.clear();
painter->setBrush(
QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackground ) ) );
painter->setPen( QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarText ) ) );
paintViewStep( painter, opt, index );
painter->restore();
}

View File

@@ -26,6 +26,9 @@ public:
protected:
QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
private:
void paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
};
#endif // PROGRESSTREEDELEGATE_H

View File

@@ -51,6 +51,6 @@ ProgressTreeView::setModel( QAbstractItemModel* model )
Calamares::ViewManager::instance(),
&Calamares::ViewManager::currentStepChanged,
this,
[this]() { viewport()->update(); },
[ this ]() { viewport()->update(); },
Qt::UniqueConnection );
}

View File

@@ -14,11 +14,8 @@
#include <QListView>
/**
* @brief Displays progress through the list of (visible) steps
*
* The ProgressTreeView class is a modified QListView which displays the
* @brief The ProgressTreeView class is a modified QTreeView which displays the
* available view steps and the user's progress through them.
* Since Calamares doesn't support "sub steps", it isn't really a tree.
*/
class ProgressTreeView : public QListView
{

View File

@@ -10,16 +10,20 @@
# (non-GUI) jobs.
#
add_definitions(-DDLLEXPORT_PRO)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
add_definitions( -DDLLEXPORT_PRO )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in
${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in
${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h )
add_library(
calamares
SHARED
set( OPTIONAL_PRIVATE_LIBRARIES "" )
set( OPTIONAL_PUBLIC_LIBRARIES "" )
set( libSources
CppJob.cpp
GlobalStorage.cpp
Job.cpp
@@ -27,11 +31,13 @@ add_library(
JobQueue.cpp
ProcessJob.cpp
Settings.cpp
# GeoIP services
geoip/Interface.cpp
geoip/GeoIPFixed.cpp
geoip/GeoIPJSON.cpp
geoip/Handler.cpp
# Locale-data service
locale/Global.cpp
locale/Lookup.cpp
@@ -40,6 +46,7 @@ add_library(
locale/TranslatableString.cpp
locale/Translation.cpp
locale/TranslationsModel.cpp
# Modules
modulesystem/Config.cpp
modulesystem/Descriptor.cpp
@@ -48,15 +55,19 @@ add_library(
modulesystem/Preset.cpp
modulesystem/RequirementsChecker.cpp
modulesystem/RequirementsModel.cpp
# Network service
network/Manager.cpp
# Packages service
packages/Globals.cpp
# Partition service
partition/Global.cpp
partition/Mount.cpp
partition/PartitionSize.cpp
partition/Sync.cpp
# Utility service
utils/CalamaresUtilsSystem.cpp
utils/CommandList.cpp
@@ -68,197 +79,248 @@ add_library(
utils/Retranslator.cpp
utils/Runner.cpp
utils/String.cpp
utils/StringExpander.cpp
utils/UMask.cpp
utils/Variant.cpp
utils/Yaml.cpp
)
set_target_properties(
calamares
PROPERTIES
VERSION ${CALAMARES_VERSION_SHORT}
SOVERSION ${CALAMARES_VERSION_SHORT}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
)
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core KF5::CoreAddons)
### OPTIONAL Automount support (requires dbus)
#
#
if(Qt5DBus_FOUND)
target_sources(calamares PRIVATE partition/AutoMount.cpp)
target_link_libraries(calamares PRIVATE Qt5::DBus)
if( Qt5DBus_FOUND)
list( APPEND libSources partition/AutoMount.cpp )
list( APPEND OPTIONAL_PRIVATE_LIBRARIES Qt5::DBus )
endif()
### OPTIONAL Python support
#
#
if(WITH_PYTHON)
target_sources(calamares PRIVATE PythonHelper.cpp PythonJob.cpp PythonJobApi.cpp)
target_link_libraries(calamares PRIVATE Python::Python Boost::python)
if( WITH_PYTHON )
list( APPEND libSources
PythonHelper.cpp
PythonJob.cpp
PythonJobApi.cpp
)
include_directories(${PYTHON_INCLUDE_DIRS})
link_directories(${PYTHON_LIBRARIES})
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
list( APPEND OPTIONAL_PRIVATE_LIBRARIES
${PYTHON_LIBRARIES}
${Boost_LIBRARIES}
)
endif()
### OPTIONAL GeoIP XML support
#
#
find_package(Qt5 COMPONENTS Xml)
if(Qt5Xml_FOUND)
target_sources(calamares PRIVATE geoip/GeoIPXML.cpp)
target_link_libraries(calamares PRIVATE Qt5::Network Qt5::Xml)
if( Qt5Xml_FOUND )
list( APPEND libSources geoip/GeoIPXML.cpp )
list( APPEND OPTIONAL_PUBLIC_LIBRARIES Qt5::Network Qt5::Xml )
endif()
### OPTIONAL KPMcore support
#
#
include(KPMcoreHelper)
include( KPMcoreHelper )
if(KPMcore_FOUND)
find_package(Qt5 REQUIRED DBus) # Needed for KPMCore
find_package(KF5 REQUIRED I18n WidgetsAddons) # Needed for KPMCore
if ( KPMcore_FOUND )
find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore
find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore
foreach(d ${KPMcore_API_DEFINITIONS})
add_definitions(-D${d})
foreach ( d ${KPMcore_API_DEFINITIONS} )
add_definitions( -D${d} )
endforeach()
include_directories(${KPMCORE_INCLUDE_DIR})
target_sources(
calamares
PRIVATE
partition/FileSystem.cpp
partition/KPMManager.cpp
partition/PartitionIterator.cpp
partition/PartitionQuery.cpp
include_directories( ${KPMCORE_INCLUDE_DIR} )
list( APPEND libSources
partition/FileSystem.cpp
partition/KPMManager.cpp
partition/PartitionIterator.cpp
partition/PartitionQuery.cpp
)
target_link_libraries(calamares PRIVATE kpmcore)
list( APPEND OPTIONAL_PRIVATE_LIBRARIES kpmcore )
endif()
### LIBRARY
#
#
add_library( calamares SHARED ${libSources} )
set_target_properties( calamares
PROPERTIES
VERSION ${CALAMARES_VERSION_SHORT}
SOVERSION ${CALAMARES_VERSION_SHORT}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
)
calamares_automoc( calamares )
target_link_libraries( calamares
LINK_PRIVATE
${OPTIONAL_PRIVATE_LIBRARIES}
LINK_PUBLIC
yamlcpp::yamlcpp
Qt5::Core
KF5::CoreAddons
${OPTIONAL_PUBLIC_LIBRARIES}
)
add_library(Calamares::calamares ALIAS calamares)
### Installation
#
#
install(
TARGETS calamares
install( TARGETS calamares
EXPORT Calamares
RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
# Make symlink lib/calamares/libcalamares.so to lib/libcalamares.so.VERSION so
# lib/calamares can be used as module path for the Python interpreter.
install(
CODE
"
install( CODE "
file( MAKE_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" )
execute_process( COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ../libcalamares.so.${CALAMARES_VERSION_SHORT} libcalamares.so WORKING_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" )
"
)
")
# Install header files
file(GLOB rootHeaders "*.h")
file( GLOB rootHeaders "*.h" )
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h ${rootHeaders}
FILES
${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h
${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h
${rootHeaders}
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach(subdir geoip locale modulesystem network partition utils)
file(GLOB subdir_headers "${subdir}/*.h")
install(FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir})
foreach( subdir geoip locale modulesystem network partition utils )
file( GLOB subdir_headers "${subdir}/*.h" )
install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} )
endforeach()
### TRANSLATION TESTING
#
# This is a support function, used just once, to help out the localetest
function(calamares_qrc_translations basename)
set(NAME ${ARGV0})
set(options "")
set(oneValueArgs SUBDIRECTORY OUTPUT_VARIABLE)
set(multiValueArgs LANGUAGES)
cmake_parse_arguments(_qrt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT _qrt_OUTPUT_VARIABLE)
set(_qrt_OUTPUT_VARIABLE "qrc_translations_${basename}")
### TESTING
#
#
calamares_add_test(
libcalamarestest
SOURCES
Tests.cpp
)
calamares_add_test(
libcalamaresgeoiptest
SOURCES
geoip/GeoIPTests.cpp
${geoip_src}
)
function ( calamares_qrc_translations basename )
set( NAME ${ARGV0} )
set( options "" )
set( oneValueArgs SUBDIRECTORY OUTPUT_VARIABLE )
set( multiValueArgs LANGUAGES )
cmake_parse_arguments( _qrt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if( NOT _qrt_OUTPUT_VARIABLE )
set( _qrt_OUTPUT_VARIABLE "qrc_translations_${basename}" )
endif()
set(translations_qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.qrc)
set(translations_qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${basename}.cxx)
set( translations_qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.qrc )
set( translations_qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${basename}.cxx )
# Must use this variable name because of the @ substitution
set(calamares_i18n_qrc_content "")
set(calamares_i18n_ts_filelist "")
foreach(lang ${_qrt_LANGUAGES})
string(APPEND calamares_i18n_qrc_content "<file>${basename}_${lang}.qm</file>")
list(
APPEND
calamares_i18n_ts_filelist
"${CMAKE_CURRENT_SOURCE_DIR}/${_qrt_SUBDIRECTORY}/${basename}_${lang}.ts"
)
set( calamares_i18n_qrc_content "" )
set( calamares_i18n_ts_filelist "" )
foreach( lang ${_qrt_LANGUAGES} )
string( APPEND calamares_i18n_qrc_content "<file>${basename}_${lang}.qm</file>" )
list( APPEND calamares_i18n_ts_filelist "${CMAKE_CURRENT_SOURCE_DIR}/${_qrt_SUBDIRECTORY}/${basename}_${lang}.ts" )
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY)
configure_file( ${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY )
qt5_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
# Run the resource compiler (rcc_options should already be set)
add_custom_command(
OUTPUT ${translations_qrc_outfile}
COMMAND "${Qt5Core_RCC_EXECUTABLE}"
ARGS
${rcc_options}
--format-version
1
-name
${basename}
-o
${translations_qrc_outfile}
${translations_qrc_infile}
ARGS ${rcc_options} --format-version 1 -name ${basename} -o ${translations_qrc_outfile} ${translations_qrc_infile}
MAIN_DEPENDENCY ${translations_qrc_infile}
DEPENDS ${QM_FILES}
)
set(${_qrt_OUTPUT_VARIABLE} ${translations_qrc_outfile} PARENT_SCOPE)
set( ${_qrt_OUTPUT_VARIABLE} ${translations_qrc_outfile} PARENT_SCOPE )
endfunction()
calamares_qrc_translations( localetest OUTPUT_VARIABLE localetest_qrc SUBDIRECTORY testdata LANGUAGES nl )
calamares_add_test(
libcalamareslocaletest
SOURCES
locale/Tests.cpp
${localetest_qrc}
)
### TESTING
#
#
calamares_add_test(libcalamarestest SOURCES Tests.cpp)
calamares_add_test(
libcalamaresmodulesystemtest
SOURCES
modulesystem/Tests.cpp
)
calamares_add_test(libcalamaresgeoiptest SOURCES geoip/GeoIPTests.cpp ${geoip_src})
calamares_add_test(
libcalamaresnetworktest
SOURCES
network/Tests.cpp
)
calamares_add_test(libcalamareslocaletest SOURCES locale/Tests.cpp ${localetest_qrc})
calamares_add_test(
libcalamarespackagestest
SOURCES
packages/Tests.cpp
)
calamares_add_test(libcalamaresmodulesystemtest SOURCES modulesystem/Tests.cpp)
calamares_add_test(
libcalamarespartitiontest
SOURCES
partition/Global.cpp
partition/Tests.cpp
LIBRARIES
${OPTIONAL_PRIVATE_LIBRARIES}
)
calamares_add_test(libcalamaresnetworktest SOURCES network/Tests.cpp)
calamares_add_test(libcalamarespackagestest SOURCES packages/Tests.cpp)
if(KPMcore_FOUND)
calamares_add_test(libcalamarespartitiontest SOURCES partition/Global.cpp partition/Tests.cpp LIBRARIES kpmcore)
calamares_add_test(libcalamarespartitionkpmtest SOURCES partition/KPMTests.cpp LIBRARIES kpmcore)
if( KPMcore_FOUND )
calamares_add_test(
libcalamarespartitionkpmtest
SOURCES
partition/KPMTests.cpp
LIBRARIES
${OPTIONAL_PRIVATE_LIBRARIES}
)
endif()
calamares_add_test(libcalamaresutilstest SOURCES utils/Tests.cpp utils/Runner.cpp)
calamares_add_test(
libcalamaresutilstest
SOURCES
utils/Tests.cpp
utils/Runner.cpp
)
calamares_add_test(
libcalamaresutilspathstest
SOURCES
utils/TestPaths.cpp
)
calamares_add_test(libcalamaresutilspathstest SOURCES utils/TestPaths.cpp)
# This is not an actual test, it's a test / demo application
# for experimenting with GeoIP.
add_executable(test_geoip geoip/test_geoip.cpp ${geoip_src})
target_link_libraries(test_geoip Calamares::calamares Qt5::Network yamlcpp::yamlcpp)
add_executable( test_geoip geoip/test_geoip.cpp ${geoip_src} )
target_link_libraries( test_geoip Calamares::calamares Qt5::Network yamlcpp::yamlcpp )
calamares_automoc( test_geoip )
if(Qt5DBus_FOUND)
add_executable(test_automount partition/calautomount.cpp)
target_link_libraries(test_automount Calamares::calamares Qt5::DBus)
if ( Qt5DBus_FOUND )
add_executable( test_automount partition/calautomount.cpp )
target_link_libraries( test_automount Calamares::calamares Qt5::DBus )
endif()

View File

@@ -25,6 +25,7 @@
* which is the CMake-time side of the same configuration.
*/
#cmakedefine WITH_PYTHON
#cmakedefine WITH_PYTHONQT
#cmakedefine WITH_QML
#endif // CALAMARESCONFIG_H

View File

@@ -89,9 +89,10 @@ public:
= m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight );
qreal totalJobWeight
= std::accumulate( jobs.cbegin(), jobs.cend(), qreal( 0.0 ), []( qreal total, const job_ptr& j ) {
return total + j->getJobWeight();
} );
= std::accumulate( jobs.cbegin(),
jobs.cend(),
qreal( 0.0 ),
[]( qreal total, const job_ptr& j ) { return total + j->getJobWeight(); } );
if ( totalJobWeight < 1 )
{
totalJobWeight = 1.0;

View File

@@ -262,7 +262,7 @@ host_env_process_output( const boost::python::list& args,
std::string
obscure( const std::string& string )
{
return Calamares::String::obscure( QString::fromStdString( string ) ).toStdString();
return CalamaresUtils::obscure( QString::fromStdString( string ) ).toStdString();
}
static QStringList

View File

@@ -290,7 +290,7 @@ Settings::reconcileInstancesAndSequence()
// Since moduleFinder captures targetKey by reference, we can
// update targetKey to change what the finder lambda looks for.
Calamares::ModuleSystem::InstanceKey targetKey;
auto moduleFinder = [&targetKey]( const InstanceDescription& d ) { return d.isValid() && d.key() == targetKey; };
auto moduleFinder = [ &targetKey ]( const InstanceDescription& d ) { return d.isValid() && d.key() == targetKey; };
// Check the sequence against the existing instances (which so far are only custom)
for ( const auto& step : m_modulesSequence )

View File

@@ -425,9 +425,8 @@ sequence:
// Make a lambda where we can adjust what it looks for from the outside,
// by capturing a reference.
QString moduleKey = QString( "welcome" );
auto moduleFinder = [&moduleKey]( const Calamares::InstanceDescription& d ) {
return d.isValid() && d.key().module() == moduleKey;
};
auto moduleFinder = [ &moduleKey ]( const Calamares::InstanceDescription& d )
{ return d.isValid() && d.key().module() == moduleKey; };
const auto it0 = std::find_if( s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder );
QVERIFY( it0 != s.moduleInstances().constEnd() );

View File

@@ -150,7 +150,7 @@ Handler::query() const
QString url = m_url;
QString selector = m_selector;
return QtConcurrent::run( [=] { return do_query( type, url, selector ); } );
return QtConcurrent::run( [ = ] { return do_query( type, url, selector ); } );
}
QString
@@ -171,7 +171,7 @@ Handler::queryRaw() const
QString url = m_url;
QString selector = m_selector;
return QtConcurrent::run( [=] { return do_raw_query( type, url, selector ); } );
return QtConcurrent::run( [ = ] { return do_raw_query( type, url, selector ); } );
}
} // namespace GeoIP

View File

@@ -43,9 +43,9 @@ lookup( TwoChar c )
}
const CountryData* p
= std::find_if( country_data_table, country_data_table + country_data_size, [c = c]( const CountryData& d ) {
return ( d.cc1 == c.cc1 ) && ( d.cc2 == c.cc2 );
} );
= std::find_if( country_data_table,
country_data_table + country_data_size,
[ c = c ]( const CountryData& d ) { return ( d.cc1 == c.cc1 ) && ( d.cc2 == c.cc2 ); } );
if ( p == country_data_table + country_data_size )
{
return nullptr;
@@ -86,7 +86,7 @@ languageForCountry( QLocale::Country country )
{
const CountryData* p = std::find_if( country_data_table,
country_data_table + country_data_size,
[c = country]( const CountryData& d ) { return d.c == c; } );
[ c = country ]( const CountryData& d ) { return d.c == c; } );
if ( p == country_data_table + country_data_size )
{
return QLocale::Language::AnyLanguage;

View File

@@ -224,16 +224,19 @@ public:
loadTZData( m_regions, m_altZones, in );
}
std::sort( m_regions.begin(), m_regions.end(), []( const RegionData* lhs, const RegionData* rhs ) {
return lhs->key() < rhs->key();
} );
std::sort( m_zones.begin(), m_zones.end(), []( const TimeZoneData* lhs, const TimeZoneData* rhs ) {
if ( lhs->region() == rhs->region() )
{
return lhs->zone() < rhs->zone();
}
return lhs->region() < rhs->region();
} );
std::sort( m_regions.begin(),
m_regions.end(),
[]( const RegionData* lhs, const RegionData* rhs ) { return lhs->key() < rhs->key(); } );
std::sort( m_zones.begin(),
m_zones.end(),
[]( const TimeZoneData* lhs, const TimeZoneData* rhs )
{
if ( lhs->region() == rhs->region() )
{
return lhs->zone() < rhs->zone();
}
return lhs->region() < rhs->region();
} );
for ( auto* z : m_zones )
{
@@ -399,7 +402,8 @@ ZonesModel::find( double latitude, double longitude ) const
* either N/S or E/W equal to any other; this obviously
* falls apart at the poles.
*/
auto distance = [&]( const TimeZoneData* zone ) -> double {
auto distance = [ & ]( const TimeZoneData* zone ) -> double
{
// Latitude doesn't wrap around: there is nothing north of 90
double latitudeDifference = abs( zone->latitude() - latitude );
@@ -445,7 +449,8 @@ ZonesModel::Iterator::operator bool() const
return 0 <= m_index && m_index < m_p->m_zones.count();
}
const TimeZoneData* ZonesModel::Iterator::operator*() const
const TimeZoneData*
ZonesModel::Iterator::operator*() const
{
if ( *this )
{

View File

@@ -40,6 +40,7 @@ interfaceNames()
{ QStringLiteral("process"), Interface::Process },
{ QStringLiteral("qtplugin"), Interface::QtPlugin },
{ QStringLiteral("python"), Interface::Python },
{ QStringLiteral("pythonqt"), Interface::PythonQt }
};
// *INDENT-ON*
// clang-format on
@@ -106,6 +107,7 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc, const QString& de
consumedKeys << "load";
break;
case Interface::Python:
case Interface::PythonQt:
d.m_script = CalamaresUtils::getString( moduleDesc, "script" );
if ( d.m_script.isEmpty() )
{

View File

@@ -42,6 +42,7 @@ enum class Interface
QtPlugin, // Jobs or Views
Python, // Jobs only
Process, // Deprecated interface
PythonQt // Views only, available as enum even if PythonQt isn't used
};
const NamedEnumTable< Interface >& interfaceNames();
@@ -113,7 +114,7 @@ public:
*/
QString script() const
{
return m_interface == Interface::Python ? m_script : QString();
return ( m_interface == Interface::Python || m_interface == Interface::PythonQt ) ? m_script : QString();
}
private:

View File

@@ -47,7 +47,7 @@ Presets::Presets( const QVariantMap& configurationMap, const QStringList& recogn
{
reserve( recognizedKeys.size() );
loadPresets(
*this, configurationMap, [&recognizedKeys]( const QString& s ) { return recognizedKeys.contains( s ); } );
*this, configurationMap, [ &recognizedKeys ]( const QString& s ) { return recognizedKeys.contains( s ); } );
}
bool

View File

@@ -76,7 +76,7 @@ RequirementsChecker::finished()
}
m_model->describe();
m_model->reCheckList();
m_model->changeRequirementsList();
QTimer::singleShot( 0, this, &RequirementsChecker::done );
}
}

View File

@@ -15,42 +15,18 @@
namespace Calamares
{
void
RequirementsModel::clear()
{
QMutexLocker l( &m_addLock );
beginResetModel();
m_requirements.clear();
endResetModel();
reCheckList();
}
void
RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements )
{
QMutexLocker l( &m_addLock );
beginResetModel();
for ( const auto& r : requirements )
{
auto it = std::find_if( m_requirements.begin(),
m_requirements.end(),
[ &r ]( const Calamares::RequirementEntry& re ) { return r.name == re.name; } );
if ( it != m_requirements.end() )
{
*it = r;
}
else
{
m_requirements.append( r );
}
}
m_requirements.append( requirements );
changeRequirementsList();
endResetModel();
reCheckList();
}
void
RequirementsModel::reCheckList()
RequirementsModel::changeRequirementsList()
{
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
@@ -58,8 +34,8 @@ RequirementsModel::reCheckList()
m_satisfiedRequirements = std::none_of( m_requirements.begin(), m_requirements.end(), isUnSatisfied );
m_satisfiedMandatory = std::none_of( m_requirements.begin(), m_requirements.end(), isMandatoryAndUnSatisfied );
Q_EMIT satisfiedRequirementsChanged( m_satisfiedRequirements );
Q_EMIT satisfiedMandatoryChanged( m_satisfiedMandatory );
emit satisfiedRequirementsChanged( m_satisfiedRequirements );
emit satisfiedMandatoryChanged( m_satisfiedMandatory );
}
int
@@ -122,7 +98,7 @@ void
RequirementsModel::setProgressMessage( const QString& m )
{
m_progressMessage = m;
Q_EMIT progressMessageChanged( m_progressMessage );
emit progressMessageChanged( m_progressMessage );
}
} // namespace Calamares

View File

@@ -33,6 +33,8 @@ class RequirementsChecker;
*/
class DLLEXPORT RequirementsModel : public QAbstractListModel
{
friend class RequirementsChecker;
Q_OBJECT
Q_PROPERTY( bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL )
Q_PROPERTY( bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL )
@@ -43,11 +45,11 @@ public:
enum Roles : short
{
NegatedText = Qt::DisplayRole,
Details = Qt::ToolTipRole,
Name = Qt::UserRole,
Name,
Satisfied,
Mandatory,
Details,
NegatedText,
HasDetails
};
// No Q_ENUM because these are exposed through roleNames()
@@ -67,15 +69,6 @@ public:
///@brief Debugging tool, describe the checking-state
void describe() const;
///@brief Update progress message (called by the checker)
void setProgressMessage( const QString& m );
///@brief Append some requirements; resets the model
void addRequirementsList( const Calamares::RequirementsList& requirements );
///@brief Check the whole list, emit signals satisfied...()
void reCheckList();
signals:
void satisfiedRequirementsChanged( bool value );
void satisfiedMandatoryChanged( bool value );
@@ -84,10 +77,16 @@ signals:
protected:
QHash< int, QByteArray > roleNames() const override;
///@brief Clears the requirements; resets the model
void clear();
///@brief Append some requirements; resets the model
void addRequirementsList( const Calamares::RequirementsList& requirements );
///@brief Update progress message (called by the checker)
void setProgressMessage( const QString& m );
private:
///@brief Implementation for {set,add}RequirementsList
void changeRequirementsList();
QString m_progressMessage;
QMutex m_addLock;
RequirementsList m_requirements;

View File

@@ -29,11 +29,16 @@ namespace Network
void
RequestOptions::applyToRequest( QNetworkRequest* request ) const
{
#if QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 )
constexpr const auto RedirectPolicyAttribute = QNetworkRequest::FollowRedirectsAttribute;
#else
constexpr const auto RedirectPolicyAttribute = QNetworkRequest::RedirectPolicyAttribute;
#endif
if ( m_flags & Flag::FollowRedirect )
{
// Follows all redirects except unsafe ones (https to http).
request->setAttribute( QNetworkRequest::RedirectPolicyAttribute, true );
request->setAttribute( RedirectPolicyAttribute, true );
}
if ( m_flags & Flag::FakeUserAgent )

View File

@@ -140,7 +140,7 @@ PackagesTests::testAdd()
{
// This is the "original" instance, so it's missing extraEditor
auto op = action[ "install" ].toList();
QCOMPARE( op.length(), packages.length()-1 ); // changed from original length
QCOMPARE( op.length(), packages.length() - 1 ); // changed from original length
QVERIFY( !op.contains( extraEditor ) );
}
}

View File

@@ -17,10 +17,13 @@
#define PARTITION_GLOBAL_H
#include "DllMacro.h"
#include "FileSystem.h"
#include "JobQueue.h"
#ifdef WITH_KPMCORE4API
#include "FileSystem.h"
#include <kpmcore/fs/filesystem.h>
#endif
namespace CalamaresUtils
{
@@ -75,6 +78,7 @@ isFilesystemUsedGS( const QString& filesystemType )
return isFilesystemUsedGS( Calamares::JobQueue::instanceGlobalStorage(), filesystemType );
}
#ifdef WITH_KPMCORE4API
/** @brief Mark a particular filesystem type as used (or not)
*
* See useFilesystemGS(const QString&, bool); this method uses the filesystem type
@@ -96,6 +100,7 @@ isFilesystemUsedGS( FileSystem::Type filesystem )
return isFilesystemUsedGS( untranslatedFS( filesystem ) );
}
#endif
} // namespace Partition
} // namespace CalamaresUtils

View File

@@ -25,8 +25,6 @@
#pragma clang diagnostic ignored "-Wdocumentation"
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override"
// Because of __lastType
#pragma clang diagnostic ignored "-Wreserved-identifier"
#endif
#include <backend/corebackend.h>

View File

@@ -14,7 +14,10 @@
#include <kpmcore/backend/corebackend.h>
#include <kpmcore/backend/corebackendmanager.h>
#if defined( WITH_KPMCORE4API )
#include <kpmcore/util/externalcommand.h>
#endif
#include <QObject>
@@ -27,6 +30,7 @@ class InternalManager
{
public:
InternalManager();
~InternalManager();
};
static bool s_kpm_loaded = false;
@@ -65,6 +69,22 @@ InternalManager::InternalManager()
}
}
InternalManager::~InternalManager()
{
#if defined( WITH_KPMCORE4API ) && !defined( WITH_KPMCORE42API )
cDebug() << "Cleaning up KPMCore backend ..";
// From KPMcore 4.0 until KPMcore 4.2 we needed to stop
// the helper by hand. KPMcore 4.2 ported to polkit directly,
// which doesn't need a helper.
auto backend_p = CoreBackendManager::self()->backend();
if ( backend_p )
{
ExternalCommand::stopHelper();
}
#endif
}
std::shared_ptr< InternalManager >
getInternal()
{

View File

@@ -57,10 +57,18 @@ KPMTests::testFlagNames()
QCOMPARE( PartitionTable::flagName( static_cast< PartitionTable::Flag >( 1 ) ), QStringLiteral( "boot" ) );
#ifdef WITH_KPMCORE4API
// KPMCore 4 unifies the flags and handles them internally
QCOMPARE( PartitionTable::flagName( PartitionTable::Flag::Boot ), QStringLiteral( "boot" ) );
QVERIFY( names.contains( QStringLiteral( "boot" ) ) );
QVERIFY( !names.contains( QStringLiteral( "esp" ) ) );
#else
// KPMCore 3 has separate flags
QCOMPARE( PartitionTable::flagName( PartitionTable::FlagBoot ), QStringLiteral( "boot" ) );
QCOMPARE( PartitionTable::flagName( PartitionTable::FlagEsp ), QStringLiteral( "esp" ) );
QVERIFY( names.contains( QStringLiteral( "boot" ) ) );
QVERIFY( names.contains( QStringLiteral( "esp" ) ) );
#endif
}
void

View File

@@ -29,7 +29,8 @@ PartitionIterator::PartitionIterator( PartitionTable* table )
{
}
Partition* PartitionIterator::operator*() const
Partition*
PartitionIterator::operator*() const
{
return m_current;
}

View File

@@ -50,7 +50,12 @@ isPartitionFreeSpace( const Partition* partition )
bool
isPartitionNew( const Partition* partition )
{
return partition->state() == Partition::State::New;
#if defined( WITH_KPMCORE4API )
constexpr auto NewState = Partition::State::New;
#else
constexpr auto NewState = Partition::StateNew;
#endif
return partition->state() == NewState;
}

View File

@@ -230,7 +230,7 @@ System::createTargetParentDirs( const QString& filePath ) const
}
QPair< quint64, qreal >
QPair< qint64, qreal >
System::getTotalMemoryB() const
{
#ifdef Q_OS_LINUX

View File

@@ -337,7 +337,7 @@ public:
*
* @return size, guesstimate-factor
*/
DLLEXPORT QPair< quint64, qreal > getTotalMemoryB() const;
DLLEXPORT QPair< qint64, qreal > getTotalMemoryB() const;
/**
* @brief getCpuDescription returns a string describing the CPU.

View File

@@ -16,7 +16,6 @@
// #include "utils/CalamaresUtils.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include "utils/StringExpander.h"
#include "utils/Variant.h"
#include <QCoreApplication>
@@ -68,48 +67,6 @@ get_variant_stringlist( const QVariantList& l )
return retl;
}
static Calamares::String::DictionaryExpander
get_gs_expander( System::RunLocation location )
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
Calamares::String::DictionaryExpander expander;
// Figure out the replacement for ${ROOT}
if ( location == System::RunLocation::RunInTarget )
{
expander.insert( QStringLiteral( "ROOT" ), QStringLiteral( "/" ) );
}
else if ( gs && gs->contains( "rootMountPoint" ) )
{
expander.insert( QStringLiteral( "ROOT" ), gs->value( "rootMountPoint" ).toString() );
}
// Replacement for ${USER}
if ( gs && gs->contains( "username" ) )
{
expander.insert( QStringLiteral( "USER" ), gs->value( "username" ).toString() );
}
return expander;
}
CommandLine
CommandLine::expand( KMacroExpanderBase& expander ) const
{
QString c = first;
expander.expandMacrosShellQuote( c );
return { c, second };
}
CalamaresUtils::CommandLine
CommandLine::expand() const
{
auto expander = get_gs_expander( System::RunLocation::RunInHost );
return expand( expander );
}
CommandList::CommandList( bool doChroot, std::chrono::seconds timeout )
: m_doChroot( doChroot )
, m_timeout( timeout )
@@ -133,7 +90,7 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch
}
else if ( v.type() == QVariant::String )
{
append( { v.toString(), m_timeout } );
append( v.toString() );
}
else if ( v.type() == QVariant::Map )
{
@@ -150,28 +107,61 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch
}
}
CommandList::~CommandList() {}
static inline bool
findInCommands( const CommandList& l, const QString& needle )
{
for ( CommandList::const_iterator i = l.cbegin(); i != l.cend(); ++i )
if ( i->command().contains( needle ) )
{
return true;
}
return false;
}
Calamares::JobResult
CommandList::run()
{
QLatin1String rootMagic( "@@ROOT@@" );
QLatin1String userMagic( "@@USER@@" );
System::RunLocation location = m_doChroot ? System::RunLocation::RunInTarget : System::RunLocation::RunInHost;
auto expander = get_gs_expander( location );
auto expandedList = expand( expander );
if ( expander.hasErrors() )
/* Figure out the replacement for @@ROOT@@ */
QString root = QStringLiteral( "/" );
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
bool needsRootSubstitution = findInCommands( *this, rootMagic );
if ( needsRootSubstitution && ( location == System::RunLocation::RunInHost ) )
{
const auto missing = expander.errorNames();
cError() << "Missing variables:" << missing;
if ( !gs || !gs->contains( "rootMountPoint" ) )
{
cError() << "No rootMountPoint defined.";
return Calamares::JobResult::error(
QCoreApplication::translate( "CommandList", "Could not run command." ),
QCoreApplication::translate( "CommandList",
"The command runs in the host environment and needs to know the root "
"path, but no rootMountPoint is defined." ) );
}
root = gs->value( "rootMountPoint" ).toString();
}
bool needsUserSubstitution = findInCommands( *this, userMagic );
if ( needsUserSubstitution && ( !gs || !gs->contains( "username" ) ) )
{
cError() << "No username defined.";
return Calamares::JobResult::error(
QCoreApplication::translate( "CommandList", "Could not run command." ),
QCoreApplication::translate( "CommandList",
"The commands use variables that are not defined. "
"Missing variables are: %1." )
.arg( missing.join( ',' ) ) );
"The command needs to know the user's name, but no username is defined." ) );
}
QString user = gs->value( "username" ).toString(); // may be blank if unset
for ( CommandList::const_iterator i = expandedList.cbegin(); i != expandedList.cend(); ++i )
for ( CommandList::const_iterator i = cbegin(); i != cend(); ++i )
{
QString processed_cmd = i->command();
processed_cmd.replace( rootMagic, root ).replace( userMagic, user );
bool suppress_result = false;
if ( processed_cmd.startsWith( '-' ) )
{
@@ -201,24 +191,10 @@ CommandList::run()
return Calamares::JobResult::ok();
}
CommandList
CommandList::expand( KMacroExpanderBase& expander ) const
void
CommandList::append( const QString& s )
{
// Copy and expand the list, collecting missing variables (so don't call expand())
CommandList expandedList( m_doChroot, m_timeout );
std::transform( cbegin(),
cend(),
std::back_inserter( expandedList ),
[ &expander ]( const CommandLine& c ) { return c.expand( expander ); } );
return expandedList;
append( CommandLine( s, m_timeout ) );
}
CommandList
CommandList::expand() const
{
auto expander = get_gs_expander( System::RunLocation::RunInHost );
return expand( expander );
}
} // namespace CalamaresUtils

View File

@@ -18,8 +18,6 @@
#include <chrono>
class KMacroExpanderBase;
namespace CalamaresUtils
{
@@ -52,20 +50,6 @@ struct CommandLine : public QPair< QString, std::chrono::seconds >
std::chrono::seconds timeout() const { return second; }
bool isValid() const { return !first.isEmpty(); }
/** @brief Returns a copy of this one command, with variables expanded
*
* The given macro-expander is used to expand the command-line.
* This will normally be a Calamares::String::DictionaryExpander
* instance, which handles the ROOT and USER variables.
*/
CommandLine expand( KMacroExpanderBase& expander ) const;
/** @brief As above, with a default macro-expander.
*
* The default macro-expander assumes RunInHost (e.g. ROOT will
* expand to the RootMountPoint set in Global Storage).
*/
CommandLine expand() const;
};
/** @brief Abbreviation, used internally. */
@@ -85,6 +69,7 @@ public:
/** @brief empty command-list with timeout to apply to entries. */
CommandList( bool doChroot = true, std::chrono::seconds timeout = std::chrono::seconds( 10 ) );
CommandList( const QVariant& v, bool doChroot = true, std::chrono::seconds timeout = std::chrono::seconds( 10 ) );
~CommandList();
bool doChroot() const { return m_doChroot; }
@@ -96,21 +81,10 @@ public:
using CommandList_t::const_iterator;
using CommandList_t::count;
using CommandList_t::isEmpty;
using CommandList_t::push_back;
using CommandList_t::value_type;
/** @brief Return a copy of this command-list, with variables expanded
*
* Each command-line in the list is expanded with the given @p expander.
* @see CommandLine::expand() for details.
*/
CommandList expand( KMacroExpanderBase& expander ) const;
/** @brief As above, with a default macro-expander.
*
* Each command-line in the list is expanded with that default macro-expander.
* @see CommandLine::expand() for details.
*/
CommandList expand() const;
protected:
using CommandList_t::append;
void append( const QString& );
private:
bool m_doChroot;

View File

@@ -53,14 +53,7 @@ setupLogLevel( unsigned int level )
{
level = LOGVERBOSE;
}
s_threshold = level + 1; // Comparison is < in logLevelEnabled() function
}
unsigned int
logLevel()
{
// Undo the +1 in setupLogLevel()
return s_threshold > 0 ? s_threshold - 1 : 0;
s_threshold = level + 1; // Comparison is < in log() function
}
bool
@@ -69,40 +62,33 @@ logLevelEnabled( unsigned int level )
return level < s_threshold;
}
/** @brief Should we call the log_implementation() function with this level?
*
* The implementation logs everything for which logLevelEnabled() is
* true to the file **and** to stdout; it logs everything at debug-level
* or below to the file regardless.
*/
static inline bool
log_enabled( unsigned int level )
unsigned int
logLevel()
{
return level <= LOGDEBUG || logLevelEnabled( level );
return s_threshold > 0 ? s_threshold - 1 : 0;
}
static void
log_implementation( const char* msg, unsigned int debugLevel, const bool withTime )
log( const char* msg, unsigned int debugLevel, bool withTime = true )
{
QMutexLocker lock( &s_mutex );
const auto date = QDate::currentDate().toString( Qt::ISODate );
const auto time = QTime::currentTime().toString();
// If we don't format the date as a Qt::ISODate then we get a crash when
// logging at exit as Qt tries to use QLocale to format, but QLocale is
// on its way out.
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << "]: " << msg << std::endl;
logfile.flush();
if ( logLevelEnabled( debugLevel ) )
{
QMutexLocker lock( &s_mutex );
// If we don't format the date as a Qt::ISODate then we get a crash when
// logging at exit as Qt tries to use QLocale to format, but QLocale is
// on its way out.
logfile << QDate::currentDate().toString( Qt::ISODate ).toUtf8().data() << " - "
<< QTime::currentTime().toString().toUtf8().data() << " ["
<< QString::number( debugLevel ).toUtf8().data() << "]: " << msg << std::endl;
logfile.flush();
if ( withTime )
{
std::cout << time.toUtf8().data() << " [" << debugLevel << "]: ";
std::cout << QTime::currentTime().toString().toUtf8().data() << " ["
<< QString::number( debugLevel ).toUtf8().data() << "]: ";
}
// The endl is desired, since it also flushes (like the logfile, above)
std::cout << msg << std::endl;
}
}
@@ -111,30 +97,29 @@ log_implementation( const char* msg, unsigned int debugLevel, const bool withTim
static void
CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg )
{
unsigned int level = LOGVERBOSE;
static QMutex s_mutex;
QByteArray ba = msg.toUtf8();
const char* message = ba.constData();
QMutexLocker locker( &s_mutex );
switch ( type )
{
case QtInfoMsg:
level = LOGVERBOSE;
log( message, LOGVERBOSE );
break;
case QtDebugMsg:
level = LOGDEBUG;
log( message, LOGDEBUG );
break;
case QtWarningMsg:
level = LOGWARNING;
log( message, LOGWARNING );
break;
case QtCriticalMsg:
case QtFatalMsg:
level = LOGERROR;
log( message, LOGERROR );
break;
}
if ( !log_enabled( level ) )
{
return;
}
log_implementation( msg.toUtf8().constData(), level, true );
}
@@ -203,14 +188,14 @@ CDebug::CDebug( unsigned int debugLevel, const char* func )
CDebug::~CDebug()
{
if ( log_enabled( m_debugLevel ) )
if ( logLevelEnabled( m_debugLevel ) )
{
if ( m_funcinfo )
{
m_msg.prepend( s_Continuation ); // Prepending, so back-to-front
m_msg.prepend( m_funcinfo );
}
log_implementation( m_msg.toUtf8().data(), m_debugLevel, bool( m_funcinfo ) );
log( m_msg.toUtf8().data(), m_debugLevel, m_funcinfo );
}
}

View File

@@ -4,6 +4,10 @@
* SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Based on KPluginFactory from KCoreAddons, KDE project
* SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
* SPDX-FileCopyrightText: 2007 Bernhard Loos <nhuh.put@web.de>
*
* Calamares is Free Software: see the License-Identifier above.
*
*
@@ -12,100 +16,81 @@
#ifndef UTILS_PLUGINFACTORY_H
#define UTILS_PLUGINFACTORY_H
#include <QObject>
#include <KPluginFactory>
#define CalamaresPluginFactory_iid "io.calamares.PluginFactory"
/** @brief Plugin factory for Calamares
*
* A Calamares plugin contains just one kind of plugin -- either
* a job, or a viewstep -- so the factory is straightforward.
* It gets a single CreateInstanceFunction and calls that;
* the function is set when registerPlugin() is called in a subclass.
* Try to re-use KPluginFactory as much as possible (since the
* old code for PluginFactory was a fork of an old version of
* exactly that).
*
* The current createInstance() method passes more arguments
* to the job and viewstep constructors than we want; chasing
* that change means modifying each Calamares module. This class
* implements a version of createInstance() with fewer arguments
* and overloads registerPlugin() to use that.
*/
class CalamaresPluginFactory : public QObject
class CalamaresPluginFactory : public KPluginFactory
{
Q_OBJECT
public:
explicit CalamaresPluginFactory() {}
explicit CalamaresPluginFactory()
: KPluginFactory()
{
}
~CalamaresPluginFactory() override;
typedef QObject* ( *CreateInstanceFunction )( QObject* );
template < class T >
T* create( QObject* parent = nullptr )
/** @brief Create an object from the factory.
*
* Ignores all the @p args since they are not used. Calls
* Calamares constructors for the Jobs and ViewSteps.
*/
template < class impl, class ParentType >
static QObject* createInstance( QWidget* parentWidget, QObject* parent, const QVariantList& args )
{
auto* op = fn ? fn( parent ) : nullptr;
if ( !op )
Q_UNUSED( parentWidget )
Q_UNUSED( args )
ParentType* p = nullptr;
if ( parent )
{
return nullptr;
p = qobject_cast< ParentType* >( parent );
Q_ASSERT( p );
}
T* tp = qobject_cast< T* >( op );
if ( !tp )
{
delete op;
}
return tp;
return new impl( p );
}
protected:
CreateInstanceFunction fn = nullptr;
/** @brief register a plugin
*
* The Calamares version doesn't accept keywords, and uses
* the Calamares createInstance() version which ignores
* the QVariantList of arguments.
*/
template < class T >
void registerPlugin()
{
KPluginFactory::registerPlugin< T >( QString(), &createInstance< T, QObject > );
}
};
/** @brief declare a Calamares Plugin Factory
*
* There should be one declaration -- generally alongside the
* class definition for the Job or ViewStep that the plugin is
* going to provide, in the header -- and one definition -- in
* the corresponding implementation.
* This would be defined as K_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY,
* except that does not actually use the base factory class that is
* passed in.
*/
#define CALAMARES_PLUGIN_FACTORY_DECLARATION( name ) \
class name : public CalamaresPluginFactory \
{ \
Q_OBJECT \
Q_INTERFACES( CalamaresPluginFactory ) \
Q_INTERFACES( KPluginFactory ) \
Q_PLUGIN_METADATA( IID CalamaresPluginFactory_iid ) \
public: \
explicit name(); \
~name() override; \
template < class T > \
static QObject* createInstance( QObject* parent ) \
{ \
return new T( parent ); \
} \
template < class T > \
void registerPlugin() \
{ \
fn = createInstance< T >; \
} \
};
/** @brief Define a Calamares Plugin Factory
*
* This should be done exactly once, generally in the translation
* unit containing the definitions for the main class of the plugin,
* either the Job or the ViewStep definitions.
*
* The @p name must match the name used in the declaration, while
* @p pluginRegistrations should be a single call to `registerPlugin<T>()`
* where `T` is the type (subclass of Job or ViewStep) defined by the
* plugin, eg.
*
* ```
* CALAMARES_PLUGIN_FACTORY_DEFINITION( MyPlugin, registerPlugin<MyPluginJob>() )
* ```
*
* Leaving out the `()` will lead to generally-weird compiler warnings.
*/
#define CALAMARES_PLUGIN_FACTORY_DEFINITION( name, pluginRegistrations ) \
name::name() \
: CalamaresPluginFactory() \
{ \
pluginRegistrations; \
} \
name::~name() {}
Q_DECLARE_INTERFACE( CalamaresPluginFactory, CalamaresPluginFactory_iid )
K_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY( name, CalamaresPluginFactory, pluginRegistrations )
#endif

View File

@@ -108,5 +108,5 @@ struct cScopedAssignment
};
template < typename T >
cScopedAssignment( T p )->cScopedAssignment< decltype( *p ) >;
cScopedAssignment( T p ) -> cScopedAssignment< decltype( *p ) >;
#endif

View File

@@ -14,12 +14,10 @@
#include "DllMacro.h"
#include "locale/Translation.h"
#include <QList>
#include <QObject>
#include <QString>
#include <functional>
#include <optional>
class QEvent;
class QLocale;
@@ -104,6 +102,7 @@ private:
explicit Retranslator( QObject* parent );
};
} // namespace CalamaresUtils
/** @brief Call code for this object when language changes
@@ -118,6 +117,16 @@ private:
* setup and translation code to be mixed together.
*/
#define CALAMARES_RETRANSLATE( body ) CalamaresUtils::Retranslator::attach( this, [ = ] { body } )
/** @brief Call code for the given object (widget) when language changes
*
* This is identical to CALAMARES_RETRANSLATE, except the @p body is called
* for the given object, not this object.
*
* NOTE: unlike plain QObject::connect(), the body is **also** called
* immediately after setting up the connection. This allows
* setup and translation code to be mixed together.
*/
#define CALAMARES_RETRANSLATE_FOR( object, body ) CalamaresUtils::Retranslator::attach( object, [ = ] { body } )
/** @brief Call a slot in this object when language changes
*
* Given a slot (in method-function-pointer notation), call that slot when the

View File

@@ -151,16 +151,19 @@ Calamares::Utils::Runner::run()
if ( m_output )
{
connect( &process, &QProcess::readyReadStandardOutput, [this, &process]() {
do
{
QString s = process.readLine();
if ( !s.isEmpty() )
{
Q_EMIT this->output( s );
}
} while ( process.canReadLine() );
} );
connect( &process,
&QProcess::readyReadStandardOutput,
[ this, &process ]()
{
do
{
QString s = process.readLine();
if ( !s.isEmpty() )
{
Q_EMIT this->output( s );
}
} while ( process.canReadLine() );
} );
}
cDebug() << Logger::SubEntry << "Running" << Logger::RedactedCommand( m_command );

View File

@@ -19,9 +19,7 @@
#include <QStringList>
namespace Calamares
{
namespace String
namespace CalamaresUtils
{
QString
removeDiacritics( const QString& string )
@@ -126,7 +124,7 @@ obscure( const QString& string )
QString
truncateMultiLine( const QString& string, LinesStartEnd lines, CharCount chars )
truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, CalamaresUtils::CharCount chars )
{
const char NEWLINE = '\n';
const int maxLines = lines.atStart + lines.atEnd;
@@ -248,5 +246,4 @@ removeTrailing( QString& string, QChar c )
string.remove( lastIndex, string.length() );
}
} // namespace String
} // namespace Calamares
} // namespace CalamaresUtils

View File

@@ -42,15 +42,10 @@ constexpr static const auto SplitKeepEmptyParts =
#endif
;
namespace Calamares
{
/**
* @brief The Calamares::String namespace
*
* This namespace contains functions related to string-handling,
* string-expansion, etc.
* @brief The CalamaresUtils namespace contains utility functions.
*/
namespace String
namespace CalamaresUtils
{
/**
* @brief removeDiacritics replaces letters with diacritics and ligatures with
@@ -118,7 +113,6 @@ DLLEXPORT void removeLeading( QString& string, QChar c );
*/
DLLEXPORT void removeTrailing( QString& string, QChar c );
} // namespace String
} // namespace Calamares
} // namespace CalamaresUtils
#endif

View File

@@ -1,89 +0,0 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2022 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#include "StringExpander.h"
#include "Logger.h"
namespace Calamares
{
namespace String
{
struct DictionaryExpander::Private
{
QHash< QString, QString > dictionary;
QStringList missing;
};
DictionaryExpander::DictionaryExpander()
: KWordMacroExpander( '$' )
, d( std::make_unique< Private >() )
{
}
DictionaryExpander::DictionaryExpander( Calamares::String::DictionaryExpander&& other )
: KWordMacroExpander( other.escapeChar() )
, d( std::move( other.d ) )
{
}
DictionaryExpander::~DictionaryExpander() {}
void
DictionaryExpander::insert( const QString& key, const QString& value )
{
d->dictionary.insert( key, value );
}
void
DictionaryExpander::clearErrors()
{
d->missing.clear();
}
bool
DictionaryExpander::hasErrors() const
{
return !d->missing.isEmpty();
}
QStringList
DictionaryExpander::errorNames() const
{
return d->missing;
}
QString
DictionaryExpander::expand( QString s )
{
clearErrors();
expandMacros( s );
return s;
}
bool
DictionaryExpander::expandMacro( const QString& str, QStringList& ret )
{
if ( d->dictionary.contains( str ) )
{
ret << d->dictionary[ str ];
return true;
}
else
{
d->missing << str;
return false;
}
}
} // namespace String
} // namespace Calamares

View File

@@ -1,67 +0,0 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2022 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef UTILS_STRINGEXPANDER_H
#define UTILS_STRINGEXPANDER_H
#include "DllMacro.h"
#include <KMacroExpander>
#include <QString>
#include <QStringList>
namespace Calamares
{
namespace String
{
/** @brief Expand variables in a string against a dictionary.
*
* This class provides a convenience API for building up a dictionary
* and using it to expand strings. Use the `expand()` method to
* do standard word-based expansion with `$` as macro-symbol.
*
* Unlike straight-up `KMacroExpander::expandMacros()`, this
* provides an API to find out which variables were missing
* from the dictionary during expansion. Use `hasErrors()` and
* `errorNames()` to find out which variables those were.
*
* Call `clearErrors()` to reset the stored errors. Calling
* `expand()` implicitly clears the errors before starting
* a new expansion, as well.
*/
class DictionaryExpander : public KWordMacroExpander
{
public:
DictionaryExpander();
DictionaryExpander( DictionaryExpander&& );
virtual ~DictionaryExpander() override;
void insert( const QString& key, const QString& value );
void clearErrors();
bool hasErrors() const;
QStringList errorNames() const;
QString expand( QString s );
protected:
virtual bool expandMacro( const QString& str, QStringList& ret ) override;
private:
struct Private;
std::unique_ptr< Private > d;
};
} // namespace String
} // namespace Calamares
#endif

View File

@@ -10,13 +10,11 @@
*/
#include "CalamaresUtilsSystem.h"
#include "CommandList.h"
#include "Entropy.h"
#include "Logger.h"
#include "RAII.h"
#include "Runner.h"
#include "String.h"
#include "StringExpander.h"
#include "Traits.h"
#include "UMask.h"
#include "Variant.h"
@@ -47,10 +45,7 @@ private Q_SLOTS:
void testLoadSaveYaml(); // Just settings.conf
void testLoadSaveYamlExtended(); // Do a find() in the src dir
/** @section Test running commands and command-expansion. */
void testCommands();
void testCommandExpansion_data();
void testCommandExpansion(); // See also shellprocess tests
/** @section Test that all the UMask objects work correctly. */
void testUmask();
@@ -80,10 +75,6 @@ private Q_SLOTS:
void testStringRemoveTrailing_data();
void testStringRemoveTrailing();
/** @section Test String expansion. */
void testStringMacroExpander_data();
void testStringMacroExpander(); // The KF5::CoreAddons bits
/** @section Test Runner directory-manipulation. */
void testRunnerDirs();
void testCalculateWorkingDirectory();
@@ -103,16 +94,6 @@ LibCalamaresTests::~LibCalamaresTests() {}
void
LibCalamaresTests::initTestCase()
{
Calamares::GlobalStorage* gs
= Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr;
if ( !gs )
{
cDebug() << "Creating new JobQueue";
(void)new Calamares::JobQueue();
gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr;
}
QVERIFY( gs );
}
void
@@ -270,34 +251,6 @@ LibCalamaresTests::testCommands()
QVERIFY( r.getOutput().contains( tfn.fileName() ) );
}
void
LibCalamaresTests::testCommandExpansion_data()
{
QTest::addColumn< QString >( "command" );
QTest::addColumn< QString >( "expected" );
QTest::newRow( "empty" ) << QString() << QString();
QTest::newRow( "ls " ) << QStringLiteral( "ls" ) << QStringLiteral( "ls" );
QTest::newRow( "user " ) << QStringLiteral( "chmod $USER" ) << QStringLiteral( "chmod alice" );
}
void
LibCalamaresTests::testCommandExpansion()
{
Calamares::GlobalStorage* gs
= Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr;
QVERIFY( gs );
gs->insert( QStringLiteral( "username" ), QStringLiteral( "alice" ) );
QFETCH( QString, command );
QFETCH( QString, expected );
CalamaresUtils::CommandLine c( command, std::chrono::seconds( 0 ) );
CalamaresUtils::CommandLine e = c.expand();
QCOMPARE( c.command(), command );
QCOMPARE( e.command(), expected );
}
void
LibCalamaresTests::testUmask()
{
@@ -601,7 +554,7 @@ LibCalamaresTests::testStringTruncation()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
using namespace Calamares::String;
using namespace CalamaresUtils;
const QString longString( R"(---
--- src/libcalamares/utils/String.h
@@ -682,7 +635,7 @@ LibCalamaresTests::testStringTruncationShorter()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
using namespace Calamares::String;
using namespace CalamaresUtils;
const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being
displayed in various user-facing messages. These have been removed
@@ -777,7 +730,7 @@ LibCalamaresTests::testStringTruncationDegenerate()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
using namespace Calamares::String;
using namespace CalamaresUtils;
// This is quite long, 1 line only, with no newlines
const QString longString( "The portscout new distfile checker has detected that one or more of your "
@@ -830,7 +783,7 @@ LibCalamaresTests::testStringRemoveLeading()
QFETCH( QString, result );
const QString initial = string;
Calamares::String::removeLeading( string, c );
CalamaresUtils::removeLeading( string, c );
QCOMPARE( string, result );
}
@@ -860,64 +813,10 @@ LibCalamaresTests::testStringRemoveTrailing()
QFETCH( QString, result );
const QString initial = string;
Calamares::String::removeTrailing( string, c );
CalamaresUtils::removeTrailing( string, c );
QCOMPARE( string, result );
}
void
LibCalamaresTests::testStringMacroExpander_data()
{
QTest::addColumn< QString >( "source" );
QTest::addColumn< QString >( "result" );
QTest::addColumn< QStringList >( "errors" );
QTest::newRow( "empty " ) << QString() << QString() << QStringList {};
QTest::newRow( "constant" ) << QStringLiteral( "bunnies!" ) << QStringLiteral( "bunnies!" ) << QStringList {};
QTest::newRow( "escaped " ) << QStringLiteral( "$$bun" ) << QStringLiteral( "$bun" )
<< QStringList {}; // Double $$ is an escaped $
QTest::newRow( "whole " ) << QStringLiteral( "${ROOT}" ) << QStringLiteral( "wortel" ) << QStringList {};
QTest::newRow( "unbraced" ) << QStringLiteral( "$ROOT" ) << QStringLiteral( "wortel" )
<< QStringList {}; // Does not need {}
QTest::newRow( "bad-var1" ) << QStringLiteral( "${ROOF}" ) << QStringLiteral( "${ROOF}" )
<< QStringList { QStringLiteral( "ROOF" ) }; // Not replaced
QTest::newRow( "twice " ) << QStringLiteral( "${ROOT}x${ROOT}" ) << QStringLiteral( "wortelxwortel" )
<< QStringList {};
QTest::newRow( "bad-var2" ) << QStringLiteral( "${ROOT}x${ROPE}" ) << QStringLiteral( "wortelx${ROPE}" )
<< QStringList { QStringLiteral( "ROPE" ) }; // Not replaced
// This is a borked string with a "nested" variable. The variable-name-
// scanner goes from ${ to the next } and tries to match that.
QTest::newRow( "confuse1" ) << QStringLiteral( "${RO${ROOT}" ) << QStringLiteral( "${ROwortel" )
<< QStringList { "RO${ROOT" };
// This one doesn't have a { for the first name to match with
QTest::newRow( "confuse2" ) << QStringLiteral( "$RO${ROOT}" ) << QStringLiteral( "$ROwortel" )
<< QStringList { "RO" };
// Here we see it just doesn't nest
QTest::newRow( "confuse3" ) << QStringLiteral( "${RO${ROOT}}" ) << QStringLiteral( "${ROwortel}" )
<< QStringList { "RO${ROOT" };
}
void
LibCalamaresTests::testStringMacroExpander()
{
QHash< QString, QString > dict;
dict.insert( QStringLiteral( "ROOT" ), QStringLiteral( "wortel" ) );
Calamares::String::DictionaryExpander d;
d.insert( QStringLiteral( "ROOT" ), QStringLiteral( "wortel" ) );
QFETCH( QString, source );
QFETCH( QString, result );
QFETCH( QStringList, errors );
QString km_expanded = KMacroExpander::expandMacros( source, dict, '$' );
QCOMPARE( km_expanded, result );
QString de_expanded = d.expand( source );
QCOMPARE( de_expanded, result );
QCOMPARE( d.errorNames(), errors );
QCOMPARE( d.hasErrors(), !errors.isEmpty() );
}
static QString
dirname( const QTemporaryDir& d )
{

View File

@@ -17,8 +17,6 @@
namespace CalamaresUtils
{
/// @brief Type for expressing units
using intunit_t = quint64;
namespace Units
{
@@ -139,19 +137,12 @@ BytesToMiB( qint64 b )
return int( b / 1024 / 1024 );
}
// TODO: deprecate signed version
constexpr int
BytesToGiB( qint64 b )
{
return int( b / 1024 / 1024 / 1024 );
}
constexpr intunit_t
BytesToGiB( intunit_t b )
{
return b / 1024 / 1024 / 1024;
}
constexpr qint64
alignBytesToBlockSize( qint64 bytes, qint64 blocksize )
{

View File

@@ -76,8 +76,10 @@ public:
{
SidebarBackground,
SidebarText,
SidebarTextCurrent,
SidebarBackgroundCurrent,
SidebarTextSelect,
SidebarTextSelected = SidebarTextSelect, // TODO:3.3:Remove SidebarTextSelect
SidebarTextHighlight,
SidebarBackgroundSelected = SidebarTextHighlight // TODO:3.3:Remove SidebarTextHighlight
};
Q_ENUM( StyleEntry )

View File

@@ -8,23 +8,24 @@
# view modules, view steps, widgets, and branding.
# The UI libs use the non-UI library
include_directories(${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_BINARY_DIR}/src/libcalamares ${CMAKE_SOURCE_DIR})
include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_BINARY_DIR}/src/libcalamares ${CMAKE_SOURCE_DIR} )
set(calamaresui_SOURCES
set( calamaresui_SOURCES
modulesystem/CppJobModule.cpp
modulesystem/ModuleFactory.cpp
modulesystem/ModuleManager.cpp
modulesystem/ProcessJobModule.cpp
modulesystem/ViewModule.cpp
# Dynamic Translation support
translation/Binding.cpp
utils/CalamaresUtilsGui.cpp
utils/ImageRegistry.cpp
utils/Paste.cpp
viewpages/BlankViewStep.cpp
viewpages/ExecutionViewStep.cpp
viewpages/Slideshow.cpp
viewpages/ViewStep.cpp
widgets/ClickableLabel.cpp
widgets/ErrorDialog.cpp
widgets/FixedAspectRatioLabel.cpp
@@ -32,20 +33,42 @@ set(calamaresui_SOURCES
widgets/LogWidget.cpp
widgets/TranslationFix.cpp
widgets/WaitingWidget.cpp
widgets/waitingspinnerwidget.cpp
${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp
Branding.cpp
ViewManager.cpp
)
if(WITH_PYTHON)
list(APPEND calamaresui_SOURCES modulesystem/PythonJobModule.cpp)
# Don't warn about third-party sources
mark_thirdparty_code(
${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp
)
if( WITH_PYTHON )
list( APPEND calamaresui_SOURCES
modulesystem/PythonJobModule.cpp
)
endif()
if(WITH_QML)
list(APPEND calamaresui_SOURCES utils/Qml.cpp viewpages/QmlViewStep.cpp)
if( WITH_PYTHONQT )
list( APPEND calamaresui_SOURCES
modulesystem/PythonQtViewModule.cpp
utils/PythonQtUtils.cpp
viewpages/PythonQtJob.cpp
viewpages/PythonQtViewStep.cpp
viewpages/PythonQtGlobalStorageWrapper.cpp
viewpages/PythonQtUtilsWrapper.cpp
)
endif()
calamares_add_library(calamaresui
if( WITH_QML )
list( APPEND calamaresui_SOURCES
utils/Qml.cpp
viewpages/QmlViewStep.cpp
)
endif()
calamares_add_library( calamaresui
SOURCES ${calamaresui_SOURCES}
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES
@@ -56,17 +79,22 @@ calamares_add_library(calamaresui
utils/ErrorDialog/ErrorDialog.ui
VERSION ${CALAMARES_VERSION_SHORT}
)
target_link_libraries(calamaresui PRIVATE yamlcpp::yamlcpp)
if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58)
target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease)
target_link_libraries(calamaresui PRIVATE KF5::CoreAddons)
target_link_libraries( calamaresui PRIVATE yamlcpp::yamlcpp )
if( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 )
target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease )
endif()
if(WITH_QML)
target_link_libraries(calamaresui PUBLIC Qt5::QuickWidgets)
if( WITH_PYTHONQT )
# *_DIRS because we also use extensions
target_include_directories( calamaresui PRIVATE ${PYTHON_INCLUDE_DIRS} ${PYTHONQT_INCLUDE_DIRS} )
target_link_libraries( calamaresui PRIVATE ${PYTHON_LIBRARIES} ${PYTHONQT_LIBRARIES} )
endif()
if( WITH_QML )
target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets )
endif()
add_library(Calamares::calamaresui ALIAS calamaresui)
### Installation
#
#
@@ -75,12 +103,24 @@ add_library(Calamares::calamaresui ALIAS calamaresui)
# where libcalamares and libcalamaresui live in different branches,
# we're going to glom it all together in the installed headers location.
install(FILES Branding.h ViewManager.h DESTINATION include/libcalamares)
install(
FILES
Branding.h
ViewManager.h
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach(subdir modulesystem utils viewpages widgets)
file(GLOB subdir_headers "${subdir}/*.h")
install(FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir})
foreach( subdir modulesystem utils viewpages widgets )
file( GLOB subdir_headers "${subdir}/*.h" )
install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} )
endforeach()
calamares_add_test(test_libcalamaresuipaste SOURCES utils/TestPaste.cpp utils/Paste.cpp LIBRARIES calamaresui)
calamares_add_test(
test_libcalamaresuipaste
SOURCES
utils/TestPaste.cpp
utils/Paste.cpp
LIBRARIES
calamaresui
)

View File

@@ -24,6 +24,10 @@
#include "PythonJobModule.h"
#endif
#ifdef WITH_PYTHONQT
#include "PythonQtViewModule.h"
#endif
#include <QDir>
#include <QFile>
#include <QFileInfo>
@@ -55,6 +59,14 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto
{
m.reset( new ViewModule() );
}
else if ( moduleDescriptor.interface() == Interface::PythonQt )
{
#ifdef WITH_PYTHONQT
m.reset( new PythonQtViewModule() );
#else
cError() << "PythonQt view modules are not supported in this version of Calamares.";
#endif
}
else
{
cError() << "Bad interface"

View File

@@ -349,18 +349,7 @@ ModuleManager::checkRequirements()
connect( rq,
&RequirementsChecker::done,
this,
[ = ]()
{
if ( m_requirementsModel->satisfiedMandatory() )
{
/* we're done */ this->requirementsComplete( true );
}
else
{
this->requirementsComplete( false );
QTimer::singleShot( std::chrono::seconds( 5 ), this, &ModuleManager::checkRequirements );
}
} );
[ = ]() { this->requirementsComplete( m_requirementsModel->satisfiedMandatory() ); } );
QTimer::singleShot( 0, rq, &RequirementsChecker::run );
}

View File

@@ -0,0 +1,184 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2018 Raul Rodrigo Segura <raurodse@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "PythonQtViewModule.h"
#include "CalamaresConfig.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "ViewManager.h"
#include "utils/Logger.h"
#include "viewpages/PythonQtGlobalStorageWrapper.h"
#include "viewpages/PythonQtUtilsWrapper.h"
#include "viewpages/PythonQtViewStep.h"
#include "viewpages/ViewStep.h"
#include <PythonQt.h>
#include <PythonQt_QtAll.h>
#include <QDir>
#include <QPointer>
static QPointer< GlobalStorage > s_gs = nullptr;
static QPointer< Utils > s_utils = nullptr;
namespace Calamares
{
Module::Type
PythonQtViewModule::type() const
{
return Module::Type::View;
}
Module::Interface
PythonQtViewModule::interface() const
{
return Module::Interface::PythonQt;
}
void
PythonQtViewModule::loadSelf()
{
if ( !m_scriptFileName.isEmpty() )
{
if ( PythonQt::self() == nullptr )
{
if ( Py_IsInitialized() )
PythonQt::init( PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut
| PythonQt::PythonAlreadyInitialized );
else
{
PythonQt::init();
}
PythonQt_QtAll::init();
cDebug() << "Initializing PythonQt bindings."
<< "This should only happen once.";
//TODO: register classes here into the PythonQt environment, like this:
//PythonQt::self()->registerClass( &PythonQtViewStep::staticMetaObject,
// "calamares" );
// We only do the following to force PythonQt to create a submodule
// "calamares" for us to put our static objects in
PythonQt::self()->registerClass( &::GlobalStorage::staticMetaObject, "calamares" );
// Get a PythonQtObjectPtr to the PythonQt.calamares submodule
PythonQtObjectPtr pqtm = PythonQt::priv()->pythonQtModule();
PythonQtObjectPtr cala = PythonQt::self()->lookupObject( pqtm, "calamares" );
// Prepare GlobalStorage object, in module PythonQt.calamares
if ( !s_gs )
{
s_gs = new ::GlobalStorage( Calamares::JobQueue::instance()->globalStorage() );
}
cala.addObject( "global_storage", s_gs );
// Prepare Utils object, in module PythonQt.calamares
if ( !s_utils )
{
s_utils = new ::Utils( Calamares::JobQueue::instance()->globalStorage() );
}
cala.addObject( "utils", s_utils );
// Append configuration object, in module PythonQt.calamares
cala.addVariable( "configuration", m_configurationMap );
// Basic stdout/stderr handling
QObject::connect( PythonQt::self(),
&PythonQt::pythonStdOut,
[]( const QString& message ) { cDebug() << "PythonQt OUT>" << message; } );
QObject::connect( PythonQt::self(),
&PythonQt::pythonStdErr,
[]( const QString& message ) { cDebug() << "PythonQt ERR>" << message; } );
}
QDir workingDir( m_workingPath );
if ( !workingDir.exists() )
{
cDebug() << "Invalid working directory" << m_workingPath << "for module" << name();
return;
}
QString fullPath = workingDir.absoluteFilePath( m_scriptFileName );
QFileInfo scriptFileInfo( fullPath );
if ( !scriptFileInfo.isReadable() )
{
cDebug() << "Invalid main script file path" << fullPath << "for module" << name();
return;
}
// Construct empty Python module with the given name
PythonQtObjectPtr cxt = PythonQt::self()->createModuleFromScript( name() );
if ( cxt.isNull() )
{
cDebug() << "Cannot load PythonQt context from file" << fullPath << "for module" << name();
return;
}
static const QLatin1String calamares_module_annotation(
"_calamares_module_typename = ''\n"
"def calamares_module(viewmodule_type):\n"
" global _calamares_module_typename\n"
" _calamares_module_typename = viewmodule_type.__name__\n"
" return viewmodule_type\n" );
// Load in the decorator
PythonQt::self()->evalScript( cxt, calamares_module_annotation );
// Load the module
PythonQt::self()->evalFile( cxt, fullPath );
m_viewStep = new PythonQtViewStep( cxt );
cDebug() << "PythonQtViewModule loading self for instance" << instanceKey() << "\nPythonQtViewModule at address"
<< this << "\nViewStep at address" << m_viewStep;
m_viewStep->setModuleInstanceKey( instanceKey() );
m_viewStep->setConfigurationMap( m_configurationMap );
ViewManager::instance()->addViewStep( m_viewStep );
m_loaded = true;
cDebug() << "PythonQtViewModule" << instanceKey() << "loading complete.";
}
}
JobList
PythonQtViewModule::jobs() const
{
return m_viewStep->jobs();
}
void
PythonQtViewModule::initFrom( const QVariantMap& moduleDescriptor )
{
QDir directory( location() );
m_workingPath = directory.absolutePath();
if ( !moduleDescriptor.value( "script" ).toString().isEmpty() )
{
m_scriptFileName = moduleDescriptor.value( "script" ).toString();
}
}
PythonQtViewModule::PythonQtViewModule()
: Module()
{
}
PythonQtViewModule::~PythonQtViewModule() {}
} // namespace Calamares

View File

@@ -0,0 +1,50 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef CALAMARES_PYTHONQTVIEWMODULE_H
#define CALAMARES_PYTHONQTVIEWMODULE_H
#include "DllMacro.h"
#include "Module.h"
namespace Calamares
{
class ViewStep;
class UIDLLEXPORT PythonQtViewModule : public Module
{
public:
Type type() const override;
Interface interface() const override;
void loadSelf() override;
JobList jobs() const override;
protected:
void initFrom( const QVariantMap& moduleDescriptor ) override;
private:
explicit PythonQtViewModule();
virtual ~PythonQtViewModule();
ViewStep* m_viewStep = nullptr;
QString m_scriptFileName;
QString m_workingPath;
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
const QString& instanceId,
const QString& configFileName,
const QString& moduleDirectory );
};
} // namespace Calamares
#endif // CALAMARES_PYTHONQTVIEWMODULE_H

View File

@@ -1,58 +0,0 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2022 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "Binding.h"
#include "utils/Retranslator.h"
namespace Calamares
{
namespace Translation
{
Binding::Binding( QWidget* parent )
: m_parent( parent )
{
connect( CalamaresUtils::Retranslator::instance(),
&CalamaresUtils::Retranslator::languageChanged,
this,
&Binding::update );
};
Binding::~Binding()
{
for ( auto* p : m_labels )
{
delete p;
}
}
void
Binding::update()
{
std::for_each( m_labels.begin(), m_labels.end(), [ parent = m_parent ]( BaseUpdater* p ) { p->update( parent ); } );
}
Binding::BaseUpdater::~BaseUpdater() {}
QString
Binding::BaseUpdater::tr( QWidget* parent ) const
{
QString text = parent->tr( untranslated_string );
if ( args.has_value() )
{
for ( const QString& s : args.value() )
{
text = text.arg( s );
}
}
return text;
}
} // namespace Translation
} // namespace Calamares

View File

@@ -1,138 +0,0 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2022 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef TRANSLATION_BINDING_H
#define TRANSLATION_BINDING_H
#include "DllMacro.h"
#include <QObject>
#include <QString>
#include <QStringList>
#include <QWidget>
#include <functional>
#include <optional>
namespace Calamares
{
namespace Translation
{
/** @brief An object that can re-translate a whole collection of widgets.
*
* A labeler should be attached to a top-level widget. Child widgets
* of that top-level can be translated via the Labeler. This removes
* the need for CALAMARES_RETRANSLATE macro calls.
*
*/
class DLLEXPORT Binding : public QObject
{
Q_OBJECT
public:
Binding( QWidget* parent );
virtual ~Binding() override;
void update();
/** @brief Adds (or updates) the string applied to a widget
*
* Sets the text on @p widget to be the (translated) @p string. If
* @p widget already has a translation set via the Labeler, the
* translation is updated with the new string.
*/
template < typename T >
void add( T* widget, const char* string )
{
(void)add_internal( widget, string );
}
template < typename T >
void add( T* widget, const char* string, const QStringList& s )
{
auto* p = add_internal( widget, string );
p->setArgs( s );
}
template < typename T >
void addUi( T* ui )
{
auto it = std::find_if( m_labels.begin(), m_labels.end(), [ = ]( BaseUpdater* p ) { return p->widget == ui; } );
if ( it == m_labels.end() )
{
auto* p = new UiUpdater< T > { ui };
m_labels.append( p );
p->update( m_parent );
}
}
private:
struct BaseUpdater
{
void* widget = nullptr;
const char* untranslated_string = nullptr;
std::optional< QStringList > args;
BaseUpdater( QWidget* w, const char* s )
: widget( w )
, untranslated_string( s )
{
}
virtual ~BaseUpdater();
virtual void update( QWidget* parent ) = 0;
QString tr( QWidget* parent ) const;
void setArgs( const QStringList& s ) { args = s; }
};
template < typename T >
struct Updater : public BaseUpdater
{
using BaseUpdater::BaseUpdater;
void update( QWidget* parent ) override { static_cast< T* >( widget )->setText( tr( parent ) ); }
};
template < typename T >
struct UiUpdater : public BaseUpdater
{
UiUpdater( T* ui )
: BaseUpdater( nullptr, nullptr )
{
widget = ui;
}
void update( QWidget* parent ) override { static_cast< T* >( widget )->retranslateUi( parent ); }
};
QWidget* m_parent = nullptr;
QList< BaseUpdater* > m_labels;
template < typename T >
BaseUpdater* add_internal( T* widget, const char* string )
{
auto it
= std::find_if( m_labels.begin(), m_labels.end(), [ = ]( BaseUpdater* p ) { return p->widget == widget; } );
if ( it != m_labels.end() )
{
( *it )->untranslated_string = string;
( *it )->update( m_parent );
return *it;
}
else
{
auto* p = new Updater< T > { widget, string };
m_labels.append( p );
p->update( m_parent );
return p;
}
}
};
} // namespace Translation
} // namespace Calamares
#endif

View File

@@ -128,12 +128,62 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
}
QPixmap
createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPct )
{
int height;
int width;
if ( !size.isEmpty() )
{
height = size.height();
width = size.width();
}
else
{
height = pixmap.height();
width = pixmap.width();
}
if ( !height || !width )
{
return QPixmap();
}
QPixmap scaledAvatar = pixmap.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
if ( frameWidthPct == 0.00f )
{
return scaledAvatar;
}
QPixmap frame( width, height );
frame.fill( Qt::transparent );
QPainter painter( &frame );
painter.setRenderHint( QPainter::Antialiasing );
QRect outerRect( 0, 0, width, height );
QBrush brush( scaledAvatar );
QPen pen;
pen.setColor( Qt::transparent );
pen.setJoinStyle( Qt::RoundJoin );
painter.setBrush( brush );
painter.setPen( pen );
painter.drawRoundedRect(
outerRect, qreal( frameWidthPct ) * 100.0, qreal( frameWidthPct ) * 100.0, Qt::RelativeSize );
return frame;
}
void
unmarginLayout( QLayout* layout )
{
if ( layout )
{
layout->setContentsMargins( 0, 0, 0, 0 );
layout->setMargin( 0 );
layout->setSpacing( 0 );
for ( int i = 0; i < layout->count(); i++ )
@@ -174,6 +224,15 @@ defaultFontHeight()
}
QFont
defaultFont()
{
QFont f;
f.setPointSize( defaultFontSize() );
return f;
}
QFont
largeFont()
{
@@ -198,4 +257,24 @@ defaultIconSize()
return QSize( w, w );
}
void
clearLayout( QLayout* layout )
{
while ( QLayoutItem* item = layout->takeAt( 0 ) )
{
if ( QWidget* widget = item->widget() )
{
widget->deleteLater();
}
if ( QLayout* childLayout = item->layout() )
{
clearLayout( childLayout );
}
delete item;
}
}
} // namespace CalamaresUtils

View File

@@ -63,6 +63,7 @@ enum ImageMode
CoverInCase,
Grid,
DropShadow,
RoundedCorners
};
/**
@@ -77,15 +78,35 @@ UIDLLEXPORT QPixmap defaultPixmap( ImageType type,
ImageMode mode = CalamaresUtils::Original,
const QSize& size = QSize( 0, 0 ) );
// TODO:3.3:This has only one consumer, move to ImageRegistry, make static
/**
* @brief createRoundedImage returns a rounded version of a pixmap.
* @param avatar the input pixmap.
* @param size the new size.
* @param frameWidthPct the frame size, as percentage of width.
* @return the transformed pixmap.
* This one is currently unused.
*/
UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size, float frameWidthPct = 0.20f );
/**
* @brief unmarginLayout recursively walks the QLayout tree and removes all margins.
* @param layout the layout to unmargin.
*/
UIDLLEXPORT void unmarginLayout( QLayout* layout );
// TODO:3.3:This has only one consumer, move to LicensePage, make static
/**
* @brief clearLayout recursively walks the QLayout tree and deletes all the child
* widgets and layouts.
* @param layout the layout to clear.
*/
UIDLLEXPORT void clearLayout( QLayout* layout );
UIDLLEXPORT void setDefaultFontSize( int points );
UIDLLEXPORT int defaultFontSize(); // in points
UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific
UIDLLEXPORT QFont defaultFont(); // TODO:3.3:This has one consumer, move to BlankViewStep
UIDLLEXPORT QFont largeFont();
UIDLLEXPORT QSize defaultIconSize();

View File

@@ -8,7 +8,6 @@
#include "ImageRegistry.h"
#include <QHash>
#include <QIcon>
#include <QPainter>
#include <QSvgRenderer>
@@ -90,6 +89,11 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
if ( !pixmap.isNull() )
{
if ( mode == CalamaresUtils::RoundedCorners )
{
pixmap = CalamaresUtils::createRoundedImage( pixmap, size );
}
if ( !size.isNull() && pixmap.size() != size )
{
if ( size.width() == 0 )

View File

@@ -0,0 +1,37 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "PythonQtUtils.h"
namespace CalamaresUtils
{
QVariant
lookupAndCall( PyObject* object,
const QStringList& candidateNames,
const QVariantList& args,
const QVariantMap& kwargs )
{
Q_ASSERT( object );
Q_ASSERT( !candidateNames.isEmpty() );
for ( const QString& name : candidateNames )
{
PythonQtObjectPtr callable = PythonQt::self()->lookupCallable( object, name );
if ( callable )
{
return callable.call( args, kwargs );
}
}
// If we haven't found a callable with the given names, we force an error:
return PythonQt::self()->call( object, candidateNames.first(), args, kwargs );
}
} // namespace CalamaresUtils

View File

@@ -0,0 +1,29 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef PYTHONQTUTILS_H
#define PYTHONQTUTILS_H
#include <PythonQt.h>
#include <QVariant>
namespace CalamaresUtils
{
//NOTE: when running this, it is assumed that Python is initialized and
// PythonQt::self() is valid.
QVariant lookupAndCall( PyObject* object,
const QStringList& candidateNames,
const QVariantList& args = QVariantList(),
const QVariantMap& kwargs = QVariantMap() );
} // namespace CalamaresUtils
#endif // PYTHONQTUTILS_H

View File

@@ -135,14 +135,14 @@ addExpansions( QmlSearch method, QStringList& candidates, const QStringList& nam
std::transform( names.constBegin(),
names.constEnd(),
std::back_inserter( candidates ),
[&]( const QString& s ) { return s.isEmpty() ? QString() : bPath.arg( brandDir, s ); } );
[ & ]( const QString& s ) { return s.isEmpty() ? QString() : bPath.arg( brandDir, s ); } );
}
if ( ( method == QmlSearch::Both ) || ( method == QmlSearch::QrcOnly ) )
{
std::transform( names.constBegin(),
names.constEnd(),
std::back_inserter( candidates ),
[&]( const QString& s ) { return s.isEmpty() ? QString() : qrPath.arg( s ); } );
[ & ]( const QString& s ) { return s.isEmpty() ? QString() : qrPath.arg( s ); } );
}
}
@@ -222,22 +222,30 @@ registerQmlModels()
// Because branding and viewmanager have a parent (CalamaresApplication
// and CalamaresWindow), they will not be deleted by QmlEngine.
// https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership
qmlRegisterSingletonType< Calamares::Branding >(
"io.calamares.ui", 1, 0, "Branding", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return Calamares::Branding::instance();
} );
qmlRegisterSingletonType< Calamares::ViewManager >(
"io.calamares.ui", 1, 0, "ViewManager", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return Calamares::ViewManager::instance();
} );
qmlRegisterSingletonType< Calamares::Branding >( "io.calamares.ui",
1,
0,
"Branding",
[]( QQmlEngine*, QJSEngine* ) -> QObject*
{ return Calamares::Branding::instance(); } );
qmlRegisterSingletonType< Calamares::ViewManager >( "io.calamares.ui",
1,
0,
"ViewManager",
[]( QQmlEngine*, QJSEngine* ) -> QObject*
{ return Calamares::ViewManager::instance(); } );
qmlRegisterSingletonType< Calamares::GlobalStorage >(
"io.calamares.core", 1, 0, "Global", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return Calamares::JobQueue::instance()->globalStorage();
} );
"io.calamares.core",
1,
0,
"Global",
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return Calamares::JobQueue::instance()->globalStorage(); } );
qmlRegisterSingletonType< CalamaresUtils::Network::Manager >(
"io.calamares.core", 1, 0, "Network", []( QQmlEngine*, QJSEngine* ) -> QObject* {
return &CalamaresUtils::Network::Manager::instance();
} );
"io.calamares.core",
1,
0,
"Network",
[]( QQmlEngine*, QJSEngine* ) -> QObject* { return &CalamaresUtils::Network::Manager::instance(); } );
}
}

View File

@@ -0,0 +1,61 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "PythonQtGlobalStorageWrapper.h"
#include "GlobalStorage.h"
GlobalStorage::GlobalStorage( Calamares::GlobalStorage* gs )
: QObject( gs )
, m_gs( gs )
{
}
bool
GlobalStorage::contains( const QString& key ) const
{
return m_gs->contains( key );
}
int
GlobalStorage::count() const
{
return m_gs->count();
}
void
GlobalStorage::insert( const QString& key, const QVariant& value )
{
m_gs->insert( key, value );
}
QStringList
GlobalStorage::keys() const
{
return m_gs->keys();
}
int
GlobalStorage::remove( const QString& key )
{
return m_gs->remove( key );
}
QVariant
GlobalStorage::value( const QString& key ) const
{
return m_gs->value( key );
}

View File

@@ -0,0 +1,48 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#ifndef PYTHONQTGLOBALSTORAGEWRAPPER_H
#define PYTHONQTGLOBALSTORAGEWRAPPER_H
#include <QObject>
#include <QStringList>
#include <QVariant>
namespace Calamares
{
class GlobalStorage;
}
/**
* @brief This GlobalStorage class is a namespace-free wrapper for
* Calamares::GlobalStorage. This is unfortunately a necessity
* because PythonQt doesn't like namespaces.
*/
class GlobalStorage : public QObject
{
Q_OBJECT
public:
explicit GlobalStorage( Calamares::GlobalStorage* gs );
virtual ~GlobalStorage() {}
public slots:
bool contains( const QString& key ) const;
int count() const;
void insert( const QString& key, const QVariant& value );
QStringList keys() const;
int remove( const QString& key );
QVariant value( const QString& key ) const;
private:
Calamares::GlobalStorage* m_gs;
};
#endif // PYTHONQTGLOBALSTORAGEWRAPPER_H

Some files were not shown because too many files have changed in this diff Show More