chore: inital commit
Split project into a Cargo workspace with two crates: - core/ (noctua_core): UI-independent document library - ui/ (noctua_ui): COSMIC application scaffold (empty) justfile for workspace (run, run-cli, check, test, build)
This commit is contained in:
commit
c85f35310e
31 changed files with 9768 additions and 0 deletions
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
.cargo/
|
||||
*.pdb
|
||||
**/*.rs.bk
|
||||
debug/
|
||||
target/
|
||||
vendor/
|
||||
vendor.tar
|
||||
debian/*
|
||||
!debian/changelog
|
||||
!debian/control
|
||||
!debian/copyright
|
||||
!debian/install
|
||||
!debian/rules
|
||||
!debian/source
|
||||
7485
Cargo.lock
generated
Normal file
7485
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Cargo.toml
|
||||
#
|
||||
# Workspace manifest for the Noctua project.
|
||||
|
||||
[workspace]
|
||||
members = ["core", "ui"]
|
||||
resolver = "2"
|
||||
674
LICENSE
Normal file
674
LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, 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
|
||||
them 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 prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If 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 convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU 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
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state 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 program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
48
core/Cargo.toml
Normal file
48
core/Cargo.toml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# core/Cargo.toml
|
||||
#
|
||||
# Core library crate – no UI dependencies.
|
||||
|
||||
[package]
|
||||
name = "noctua_core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Document core library for the Noctua viewer"
|
||||
repository = "https://codeberg.org/wfx/noctua"
|
||||
authors = ["Wolfgang Morawetz <wfx@mailbox.org>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[lib]
|
||||
name = "noctua_core"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[features]
|
||||
default = ["image", "vector", "portable"]
|
||||
image = ["dep:image", "dep:kamadak-exif"]
|
||||
vector = ["dep:resvg"]
|
||||
portable = ["dep:pdfium-render"]
|
||||
full = ["image", "vector", "portable"]
|
||||
|
||||
[dependencies]
|
||||
# Serialization
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
ron = "0.8"
|
||||
|
||||
# Feature-gated document backends
|
||||
image = { version = "0.25", optional = true }
|
||||
kamadak-exif = { version = "0.5", optional = true }
|
||||
pdfium-render = { version = "0.8", optional = true }
|
||||
resvg = { version = "0.45", optional = true }
|
||||
|
||||
# Logging interface
|
||||
log = "0.4"
|
||||
|
||||
# Thumbnail cache (freedesktop.org spec)
|
||||
dirs = "5.0"
|
||||
md5 = "0.7"
|
||||
png = "0.17"
|
||||
|
||||
[dev-dependencies]
|
||||
# CLI test harness (examples/cli.rs only)
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
env_logger = "0.11"
|
||||
147
core/examples/cli.rs
Normal file
147
core/examples/cli.rs
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// examples/cli.rs
|
||||
//
|
||||
// CLI test harness for the noctua_core document foundation.
|
||||
|
||||
use clap::{ArgGroup, Parser};
|
||||
use noctua_core::document::manager::{DocumentCommand, DocumentManager, DocumentState};
|
||||
use noctua_core::document::session::SessionKind;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(
|
||||
name = "noctua",
|
||||
about = "A document viewer for the COSMIC desktop",
|
||||
group(
|
||||
ArgGroup::new("source")
|
||||
.required(true)
|
||||
.args(["open_document", "open_directory", "open_session"])
|
||||
)
|
||||
)]
|
||||
struct Cli {
|
||||
/// Open a document (Raster, Vector, Portable)
|
||||
#[arg(long, value_name = "PATH")]
|
||||
open_document: Option<PathBuf>,
|
||||
|
||||
/// Open a directory
|
||||
#[arg(long, value_name = "PATH")]
|
||||
open_directory: Option<PathBuf>,
|
||||
|
||||
/// Open a session file (.ron)
|
||||
#[arg(long, value_name = "PATH")]
|
||||
open_session: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
|
||||
let cli = Cli::parse();
|
||||
let mut manager = DocumentManager::new();
|
||||
|
||||
if let Some(path) = cli.open_session {
|
||||
manager.handle(DocumentCommand::OpenSession(path));
|
||||
} else if let Some(path) = cli.open_document {
|
||||
let dir = path
|
||||
.parent()
|
||||
.map(|p| p.to_path_buf())
|
||||
.unwrap_or_else(|| PathBuf::from("."));
|
||||
|
||||
let session_name = dir
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.unwrap_or("Browse")
|
||||
.to_string();
|
||||
|
||||
if manager.session(&session_name).is_none() {
|
||||
manager.handle(DocumentCommand::CreateSession {
|
||||
name: session_name.clone(),
|
||||
kind: SessionKind::DirectoryBrowser,
|
||||
path: Some(dir.clone()),
|
||||
});
|
||||
manager.handle(DocumentCommand::ScanDirectory {
|
||||
session: session_name.clone(),
|
||||
dir,
|
||||
});
|
||||
}
|
||||
|
||||
manager.handle(DocumentCommand::AddFileToSession {
|
||||
session: session_name,
|
||||
path,
|
||||
});
|
||||
} else if let Some(path) = cli.open_directory {
|
||||
let session_name = path
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.unwrap_or("Browse")
|
||||
.to_string();
|
||||
|
||||
if manager.session(&session_name).is_none() {
|
||||
manager.handle(DocumentCommand::CreateSession {
|
||||
name: session_name.clone(),
|
||||
kind: SessionKind::DirectoryBrowser,
|
||||
path: Some(path.clone()),
|
||||
});
|
||||
manager.handle(DocumentCommand::ScanDirectory {
|
||||
session: session_name.clone(),
|
||||
dir: path,
|
||||
});
|
||||
}
|
||||
|
||||
manager.handle(DocumentCommand::SetActive(session_name));
|
||||
}
|
||||
|
||||
match &manager.state {
|
||||
DocumentState::Empty => println!("UI: No document loaded."),
|
||||
DocumentState::Loading => println!("UI: Loading..."),
|
||||
DocumentState::Error(err) => eprintln!("UI: Error -> {err}"),
|
||||
DocumentState::Loaded(_) => {
|
||||
println!("UI: Document loaded.");
|
||||
|
||||
if let Some(name) = manager.active_session_name.clone() {
|
||||
if let Some(session) = manager.session(&name) {
|
||||
println!(
|
||||
"UI: Session '{}' ({:?}) has {} items, current index: {:?}",
|
||||
session.name,
|
||||
session.kind,
|
||||
session.items.len(),
|
||||
session.current_index
|
||||
);
|
||||
|
||||
match session.kind {
|
||||
SessionKind::DirectoryBrowser => {
|
||||
println!("UI: Display as directory browser (thumbnails in left panel)");
|
||||
}
|
||||
SessionKind::DocumentCollection => {
|
||||
println!("UI: Display as document collection (pages)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("\nUI: Test navigation...");
|
||||
manager.handle(DocumentCommand::NavigateNext);
|
||||
if let Some(session) = manager.session(&name) {
|
||||
println!(
|
||||
"UI: After NavigateNext -> index {:?}",
|
||||
session.current_index
|
||||
);
|
||||
}
|
||||
|
||||
manager.handle(DocumentCommand::NavigatePrevious);
|
||||
if let Some(session) = manager.session(&name) {
|
||||
println!(
|
||||
"UI: After NavigatePrevious -> index {:?}",
|
||||
session.current_index
|
||||
);
|
||||
}
|
||||
|
||||
manager.handle(DocumentCommand::SelectItem(0));
|
||||
if let Some(session) = manager.session(&name) {
|
||||
println!(
|
||||
"UI: After SelectItem(0) -> index {:?}",
|
||||
session.current_index
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
core/src/document/core.rs
Normal file
56
core/src/document/core.rs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/core.rs
|
||||
//
|
||||
// Core domain models for document representation.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RawImage {
|
||||
pub data: Arc<Vec<u8>>,
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PageLayout {
|
||||
pub page_starts: Vec<f64>,
|
||||
pub page_sizes: Vec<(f64, f64)>,
|
||||
pub gap: f64,
|
||||
pub total_height: f64,
|
||||
pub max_width: f64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ViewBox {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
pub width: f64,
|
||||
pub height: f64,
|
||||
}
|
||||
|
||||
impl PageLayout {
|
||||
pub fn new(page_sizes: Vec<(f64, f64)>, gap: f64) -> Self {
|
||||
let mut page_starts = Vec::with_capacity(page_sizes.len());
|
||||
let mut y = 0.0_f64;
|
||||
let mut max_width = 0.0_f64;
|
||||
|
||||
for &(w, h) in &page_sizes {
|
||||
page_starts.push(y);
|
||||
y += h + gap;
|
||||
if w > max_width {
|
||||
max_width = w;
|
||||
}
|
||||
}
|
||||
|
||||
let total_height = if !page_sizes.is_empty() { y - gap } else { 0.0 };
|
||||
|
||||
Self {
|
||||
page_starts,
|
||||
page_sizes,
|
||||
gap,
|
||||
total_height,
|
||||
max_width,
|
||||
}
|
||||
}
|
||||
}
|
||||
38
core/src/document/format.rs
Normal file
38
core/src/document/format.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/format.rs
|
||||
//
|
||||
// Single source of truth for document format detection.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
/// The three document formats Noctua understands.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum DocumentFormat {
|
||||
/// Raster images – anything libcosmic's image crate can decode.
|
||||
Raster,
|
||||
/// Vector graphics (SVG).
|
||||
Vector,
|
||||
/// Portable documents (PDF).
|
||||
Portable,
|
||||
}
|
||||
|
||||
/// Detects the document format from the file extension.
|
||||
///
|
||||
/// Returns `None` for unknown extensions so directory scans can skip
|
||||
/// unsupported files early. At load time the underlying library
|
||||
/// (ImageReader, usvg, pdfium) is the final authority.
|
||||
pub fn detect_format(path: &Path) -> Option<DocumentFormat> {
|
||||
match path
|
||||
.extension()
|
||||
.and_then(|e| e.to_str())
|
||||
.map(|e| e.to_lowercase())
|
||||
.as_deref()
|
||||
{
|
||||
Some("pdf") => Some(DocumentFormat::Portable),
|
||||
Some("svg") => Some(DocumentFormat::Vector),
|
||||
Some("png" | "jpg" | "jpeg" | "webp" | "gif" | "bmp" | "tiff" | "tif") => {
|
||||
Some(DocumentFormat::Raster)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
72
core/src/document/loader.rs
Normal file
72
core/src/document/loader.rs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/loader.rs
|
||||
//
|
||||
// Document loading: format dispatch and directory scanning.
|
||||
|
||||
use crate::document::format::{detect_format, DocumentFormat};
|
||||
use crate::document::portable::PortableModel;
|
||||
use crate::document::raster::RasterModel;
|
||||
use crate::document::session::{SessionData, SessionItem};
|
||||
use crate::document::vector::VectorModel;
|
||||
use crate::document::{core::PageLayout, DocumentContent};
|
||||
use crate::error::{Error, Result};
|
||||
use std::path::Path;
|
||||
|
||||
/// Loads a document from a path and returns its content.
|
||||
pub fn load_document(path: &Path) -> Result<DocumentContent> {
|
||||
if !path.exists() {
|
||||
return Err(Error::NotFound(format!("{:?}", path)));
|
||||
}
|
||||
|
||||
match detect_format(path) {
|
||||
Some(DocumentFormat::Portable) => {
|
||||
// TODO: Replace with actual pdfium-render loading.
|
||||
Ok(DocumentContent::Portable(PortableModel {
|
||||
path: path.to_path_buf(),
|
||||
page_count: 3,
|
||||
layout: PageLayout::new(vec![(595.0, 842.0); 3], 10.0),
|
||||
}))
|
||||
}
|
||||
Some(DocumentFormat::Vector) => {
|
||||
// TODO: Replace with actual usvg parsing.
|
||||
Ok(DocumentContent::Vector(VectorModel {
|
||||
path: path.to_path_buf(),
|
||||
view_box: None,
|
||||
}))
|
||||
}
|
||||
Some(DocumentFormat::Raster) => {
|
||||
// TODO: Replace with actual image-crate loading.
|
||||
Ok(DocumentContent::Raster(RasterModel {
|
||||
path: path.to_path_buf(),
|
||||
dimensions: (1920, 1080),
|
||||
}))
|
||||
}
|
||||
None => Err(Error::Unsupported(format!(
|
||||
"extension: {}",
|
||||
path.extension()
|
||||
.and_then(|e| e.to_str())
|
||||
.unwrap_or("(none)")
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
/// Scans a directory for supported files and populates the session.
|
||||
pub fn scan_directory_into(session: &mut SessionData, dir: &Path) {
|
||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
||||
let mut paths: Vec<_> = entries
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|e| e.path())
|
||||
.filter(|p| p.is_file() && detect_format(p).is_some())
|
||||
.collect();
|
||||
|
||||
paths.sort();
|
||||
|
||||
session.items = paths.into_iter().map(|p| SessionItem::new(p, 0)).collect();
|
||||
}
|
||||
|
||||
session.current_index = if session.items.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(0)
|
||||
};
|
||||
}
|
||||
223
core/src/document/manager.rs
Normal file
223
core/src/document/manager.rs
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/manager.rs
|
||||
//
|
||||
// Document Manager – single entry point via DocumentCommand.
|
||||
|
||||
use crate::document::loader::{load_document, scan_directory_into};
|
||||
use crate::document::session::{SessionData, SessionKind};
|
||||
use crate::document::store;
|
||||
use crate::document::DocumentContent;
|
||||
use crate::error::Error;
|
||||
use log::warn;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub enum DocumentState {
|
||||
Empty,
|
||||
Loading,
|
||||
Loaded(DocumentContent),
|
||||
Error(Error),
|
||||
}
|
||||
|
||||
/// All actions the UI can request from the manager.
|
||||
/// The manager executes; the UI decides.
|
||||
#[derive(Debug)]
|
||||
pub enum DocumentCommand {
|
||||
/// Create a new session. Does nothing if a session with that name already exists.
|
||||
CreateSession {
|
||||
name: String,
|
||||
kind: SessionKind,
|
||||
path: Option<PathBuf>,
|
||||
},
|
||||
/// Scan a directory into an existing session, replacing its current items.
|
||||
ScanDirectory { session: String, dir: PathBuf },
|
||||
/// Load a file and make it the active item in the given session.
|
||||
AddFileToSession { session: String, path: PathBuf },
|
||||
/// Set the active session by name.
|
||||
SetActive(String),
|
||||
/// Open a session file (.ron): loads all sessions and activates the DirectoryBrowser.
|
||||
OpenSession(PathBuf),
|
||||
/// Navigate to the next item in the active session.
|
||||
NavigateNext,
|
||||
/// Navigate to the previous item in the active session.
|
||||
NavigatePrevious,
|
||||
/// Select a specific item by index in the active session.
|
||||
SelectItem(usize),
|
||||
}
|
||||
|
||||
pub struct DocumentManager {
|
||||
sessions: Vec<SessionData>,
|
||||
pub active_session_name: Option<String>,
|
||||
pub state: DocumentState,
|
||||
}
|
||||
|
||||
impl Default for DocumentManager {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
sessions: Vec::new(),
|
||||
active_session_name: None,
|
||||
state: DocumentState::Empty,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DocumentManager {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// The single public entry point for all state changes.
|
||||
pub fn handle(&mut self, command: DocumentCommand) {
|
||||
match command {
|
||||
DocumentCommand::CreateSession { name, kind, path } => {
|
||||
if self.session(&name).is_none() {
|
||||
self.sessions
|
||||
.push(SessionData::new(&name, kind, path, Vec::new()));
|
||||
}
|
||||
}
|
||||
|
||||
DocumentCommand::ScanDirectory { session, dir } => {
|
||||
if let Some(s) = self.session_mut(&session) {
|
||||
scan_directory_into(s, &dir);
|
||||
}
|
||||
}
|
||||
|
||||
DocumentCommand::AddFileToSession { session, path } => {
|
||||
self.active_session_name = Some(session);
|
||||
self.load_file(&path);
|
||||
}
|
||||
|
||||
DocumentCommand::SetActive(name) => {
|
||||
if self.session(&name).is_some() {
|
||||
self.active_session_name = Some(name);
|
||||
}
|
||||
}
|
||||
|
||||
DocumentCommand::OpenSession(path) => {
|
||||
self.load_all_sessions(&path);
|
||||
}
|
||||
|
||||
DocumentCommand::NavigateNext => self.next(),
|
||||
DocumentCommand::NavigatePrevious => self.previous(),
|
||||
DocumentCommand::SelectItem(index) => self.select_item(index),
|
||||
}
|
||||
}
|
||||
|
||||
/// Read-only access to a session by name.
|
||||
pub fn session(&self, name: &str) -> Option<&SessionData> {
|
||||
self.sessions.iter().find(|s| s.name == name)
|
||||
}
|
||||
|
||||
// Mutable access to a session by name.
|
||||
fn session_mut(&mut self, name: &str) -> Option<&mut SessionData> {
|
||||
self.sessions.iter_mut().find(|s| s.name == name)
|
||||
}
|
||||
|
||||
// Mutable access to the currently active session.
|
||||
// The name is cloned to satisfy the borrow checker – it is a cheap String copy.
|
||||
fn active_session_mut(&mut self) -> Option<&mut SessionData> {
|
||||
let name = self.active_session_name.clone()?;
|
||||
self.sessions.iter_mut().find(|s| s.name == name)
|
||||
}
|
||||
|
||||
// Loads all sessions from a RON file and activates the DirectoryBrowser.
|
||||
fn load_all_sessions(&mut self, path: &Path) {
|
||||
match store::load_sessions(path) {
|
||||
Ok(mut loaded) => {
|
||||
// Re-scan every DirectoryBrowser's source directory on load.
|
||||
// Validate every DocumentCollection: remove items whose files no longer exist.
|
||||
for session in loaded.iter_mut() {
|
||||
match session.kind {
|
||||
SessionKind::DirectoryBrowser => {
|
||||
if let Some(dir) = session.path.clone() {
|
||||
scan_directory_into(session, &dir);
|
||||
}
|
||||
}
|
||||
SessionKind::DocumentCollection => {
|
||||
session.items.retain(|item| {
|
||||
if item.path.exists() {
|
||||
true
|
||||
} else {
|
||||
warn!(
|
||||
"Session '{}': {}",
|
||||
session.name,
|
||||
Error::NotFound(item.path.display().to_string())
|
||||
);
|
||||
false
|
||||
}
|
||||
});
|
||||
|
||||
// Reset index if it pointed to a now-removed item.
|
||||
session.current_index = match session.current_index {
|
||||
Some(i) if i < session.items.len() => Some(i),
|
||||
_ if !session.items.is_empty() => Some(0),
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Activate the DirectoryBrowser as the default entry point.
|
||||
let browser_name = loaded
|
||||
.iter()
|
||||
.find(|s| s.kind == SessionKind::DirectoryBrowser)
|
||||
.map(|s| s.name.clone());
|
||||
|
||||
self.sessions = loaded;
|
||||
self.active_session_name = browser_name;
|
||||
self.state = DocumentState::Empty;
|
||||
}
|
||||
Err(e) => {
|
||||
self.state = DocumentState::Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn select_item(&mut self, index: usize) {
|
||||
if let Some(session) = self.active_session_mut() {
|
||||
if index < session.items.len() {
|
||||
session.current_index = Some(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn next(&mut self) {
|
||||
if let Some(session) = self.active_session_mut() {
|
||||
if let Some(idx) = session.current_index {
|
||||
if idx + 1 < session.items.len() {
|
||||
session.current_index = Some(idx + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn previous(&mut self) {
|
||||
if let Some(session) = self.active_session_mut() {
|
||||
if let Some(idx) = session.current_index {
|
||||
if idx > 0 {
|
||||
session.current_index = Some(idx - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn load_file(&mut self, path: &Path) {
|
||||
self.state = DocumentState::Loading;
|
||||
|
||||
match load_document(path) {
|
||||
Ok(content) => {
|
||||
// Align current_index to the loaded file's position in the session.
|
||||
if let Some(session) = self.active_session_mut() {
|
||||
if let Some(idx) = session.items.iter().position(|item| item.path == path) {
|
||||
session.current_index = Some(idx);
|
||||
}
|
||||
}
|
||||
self.state = DocumentState::Loaded(content);
|
||||
}
|
||||
Err(e) => {
|
||||
self.state = DocumentState::Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
core/src/document/mod.rs
Normal file
26
core/src/document/mod.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/mod.rs
|
||||
//
|
||||
// Document abstraction and format definitions.
|
||||
|
||||
pub mod core;
|
||||
pub mod format;
|
||||
pub mod loader;
|
||||
pub mod manager;
|
||||
pub mod portable;
|
||||
pub mod raster;
|
||||
pub mod session;
|
||||
pub mod store;
|
||||
pub mod vector;
|
||||
|
||||
use self::portable::PortableModel;
|
||||
use self::raster::RasterModel;
|
||||
use self::vector::VectorModel;
|
||||
|
||||
/// Represents the physical content of a loaded document.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DocumentContent {
|
||||
Raster(RasterModel),
|
||||
Vector(VectorModel),
|
||||
Portable(PortableModel),
|
||||
}
|
||||
14
core/src/document/portable.rs
Normal file
14
core/src/document/portable.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/portable.rs
|
||||
//
|
||||
// Portable document format model (PDF).
|
||||
|
||||
use crate::document::core::PageLayout;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PortableModel {
|
||||
pub path: PathBuf,
|
||||
pub page_count: usize,
|
||||
pub layout: PageLayout,
|
||||
}
|
||||
12
core/src/document/raster.rs
Normal file
12
core/src/document/raster.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/raster.rs
|
||||
//
|
||||
// Raster image document model (JPEG, PNG, etc.).
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RasterModel {
|
||||
pub path: PathBuf,
|
||||
pub dimensions: (u32, u32),
|
||||
}
|
||||
80
core/src/document/session.rs
Normal file
80
core/src/document/session.rs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/session.rs
|
||||
//
|
||||
// A session is the unit of work in Noctua. It groups a set of document items
|
||||
// under a name and tracks which item is currently active.
|
||||
//
|
||||
// There are two kinds of session:
|
||||
//
|
||||
// DirectoryBrowser
|
||||
// Represents a directory on disk. Items are populated by scanning the
|
||||
// directory at open time and re-scanned each time the session file is
|
||||
// loaded – the persisted item list is intentionally ignored on load.
|
||||
// The source directory is stored in `path`.
|
||||
//
|
||||
// DocumentCollection
|
||||
// A curated, ordered list of documents (or individual pages within them).
|
||||
// Items are persisted exactly as stored. Missing files are detected and
|
||||
// removed with a warning when the session file is loaded.
|
||||
// `path` is None for this kind.
|
||||
//
|
||||
// The on-disk representation of a session list is managed by `store.rs`.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Determines how a session's items are managed.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub enum SessionKind {
|
||||
/// Items are derived from a directory scan; `path` holds the source directory.
|
||||
DirectoryBrowser,
|
||||
/// Items are a curated list of documents or pages; `path` is None.
|
||||
DocumentCollection,
|
||||
}
|
||||
|
||||
/// A single entry in a session – a file path and an optional page within that file.
|
||||
///
|
||||
/// `page_index` is 0 for single-page formats (raster, SVG) and non-zero for
|
||||
/// multi-page documents (PDF, multi-frame TIFF) where each page is its own item.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SessionItem {
|
||||
pub path: PathBuf,
|
||||
pub page_index: usize,
|
||||
}
|
||||
|
||||
impl SessionItem {
|
||||
pub fn new(path: PathBuf, page_index: usize) -> Self {
|
||||
Self { path, page_index }
|
||||
}
|
||||
}
|
||||
|
||||
/// The full state of a session.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SessionData {
|
||||
pub name: String,
|
||||
pub kind: SessionKind,
|
||||
/// Source directory for `DirectoryBrowser` sessions; `None` for `DocumentCollection`.
|
||||
#[serde(default)]
|
||||
pub path: Option<PathBuf>,
|
||||
pub items: Vec<SessionItem>,
|
||||
/// Index of the currently active item, or `None` if the session is empty.
|
||||
pub current_index: Option<usize>,
|
||||
}
|
||||
|
||||
impl SessionData {
|
||||
pub fn new(
|
||||
name: &str,
|
||||
kind: SessionKind,
|
||||
path: Option<PathBuf>,
|
||||
items: Vec<SessionItem>,
|
||||
) -> Self {
|
||||
let current_index = if items.is_empty() { None } else { Some(0) };
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
kind,
|
||||
path,
|
||||
items,
|
||||
current_index,
|
||||
}
|
||||
}
|
||||
}
|
||||
49
core/src/document/store.rs
Normal file
49
core/src/document/store.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/store.rs
|
||||
//
|
||||
// RON-based persistence for session data: load and save session lists.
|
||||
//
|
||||
// For the session concept and the meaning of each field see `session.rs`.
|
||||
//
|
||||
// On disk a session file contains a RON list of SessionData records:
|
||||
//
|
||||
// [
|
||||
// (
|
||||
// name: "Pictures",
|
||||
// kind: DirectoryBrowser,
|
||||
// path: Some("/home/user/Pictures"),
|
||||
// items: [],
|
||||
// current_index: None,
|
||||
// ),
|
||||
// (
|
||||
// name: "Project Docs",
|
||||
// kind: DocumentCollection,
|
||||
// path: None,
|
||||
// items: [
|
||||
// (path: "/home/user/docs/spec.pdf", page_index: 0),
|
||||
// (path: "/home/user/docs/notes.pdf", page_index: 2),
|
||||
// ],
|
||||
// current_index: Some(0),
|
||||
// ),
|
||||
// ]
|
||||
|
||||
use crate::document::session::SessionData;
|
||||
use crate::error::{Error, Result};
|
||||
use std::path::Path;
|
||||
|
||||
/// Loads all sessions from a RON file.
|
||||
pub fn load_sessions(path: &Path) -> Result<Vec<SessionData>> {
|
||||
let content = std::fs::read_to_string(path).map_err(Error::Io)?;
|
||||
|
||||
ron::from_str(&content)
|
||||
.map_err(|e| Error::Session(format!("Failed to parse session file {:?}: {}", path, e)))
|
||||
}
|
||||
|
||||
/// Saves all sessions to a RON file.
|
||||
#[allow(dead_code)]
|
||||
pub fn save_sessions(path: &Path, sessions: &[SessionData]) -> Result<()> {
|
||||
let content = ron::ser::to_string_pretty(sessions, ron::ser::PrettyConfig::default())
|
||||
.map_err(|e| Error::Session(format!("Failed to serialize sessions: {}", e)))?;
|
||||
|
||||
std::fs::write(path, content).map_err(Error::Io)
|
||||
}
|
||||
13
core/src/document/vector.rs
Normal file
13
core/src/document/vector.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/document/vector.rs
|
||||
//
|
||||
// Vector image document model (SVG).
|
||||
|
||||
use crate::document::core::ViewBox;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct VectorModel {
|
||||
pub path: PathBuf,
|
||||
pub view_box: Option<ViewBox>,
|
||||
}
|
||||
49
core/src/error/kinds.rs
Normal file
49
core/src/error/kinds.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/error/kinds.rs
|
||||
//
|
||||
// Central error types for Noctua.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
/// A requested file or resource was not found.
|
||||
NotFound(String),
|
||||
/// The file format or operation is not supported.
|
||||
Unsupported(String),
|
||||
/// A rendering operation failed.
|
||||
Render(String),
|
||||
/// A session could not be loaded or saved.
|
||||
Session(String),
|
||||
/// An underlying I/O error.
|
||||
Io(std::io::Error),
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Error::NotFound(msg) => write!(f, "Not found: {}", msg),
|
||||
Error::Unsupported(msg) => write!(f, "Unsupported: {}", msg),
|
||||
Error::Render(msg) => write!(f, "Render error: {}", msg),
|
||||
Error::Session(msg) => write!(f, "Session error: {}", msg),
|
||||
Error::Io(err) => write!(f, "I/O error: {}", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
Error::Io(err) => Some(err),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
fn from(err: std::io::Error) -> Self {
|
||||
Error::Io(err)
|
||||
}
|
||||
}
|
||||
8
core/src/error/mod.rs
Normal file
8
core/src/error/mod.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/error/mod.rs
|
||||
//
|
||||
// Central error module – re-exports the shared Error and Result types.
|
||||
|
||||
mod kinds;
|
||||
|
||||
pub use kinds::{Error, Result};
|
||||
8
core/src/lib.rs
Normal file
8
core/src/lib.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/lib.rs
|
||||
//
|
||||
// Public API of the noctua_core library.
|
||||
|
||||
pub mod document;
|
||||
pub mod error;
|
||||
pub mod render;
|
||||
4
core/src/render/converter.rs
Normal file
4
core/src/render/converter.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/render/converter.rs
|
||||
//
|
||||
// Converts raw document data into renderable page output.
|
||||
8
core/src/render/mod.rs
Normal file
8
core/src/render/mod.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/render/mod.rs
|
||||
//
|
||||
// Rendering subsystem: converts document content into displayable output.
|
||||
|
||||
pub mod converter;
|
||||
pub mod page;
|
||||
pub mod thumbnail;
|
||||
4
core/src/render/page.rs
Normal file
4
core/src/render/page.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/render/page.rs
|
||||
//
|
||||
// Page layout and rendering primitives (scaffold – not yet implemented).
|
||||
4
core/src/render/thumbnail.rs
Normal file
4
core/src/render/thumbnail.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/render/thumbnail.rs
|
||||
//
|
||||
// Thumbnail cache following the freedesktop.org thumbnail spec.
|
||||
4
i18n.toml
Normal file
4
i18n.toml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fallback_language = "en"
|
||||
|
||||
[fluent]
|
||||
assets_dir = "i18n"
|
||||
119
i18n/en/noctua.ftl
Normal file
119
i18n/en/noctua.ftl
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# i18n/en/noctua.ftl
|
||||
#
|
||||
# Localization strings for Noctua (English).
|
||||
# Usage: fl!("message-id", arg1, arg2, ...)
|
||||
#
|
||||
# Positional arguments ($1, $2, ...) are used for variable content.
|
||||
|
||||
|
||||
## Application
|
||||
noctua-app-name = Noctua
|
||||
noctua-app-description = A document and image viewer for the COSMIC desktop
|
||||
|
||||
|
||||
## Main window
|
||||
window-title = { $filename ->
|
||||
[none] Noctua
|
||||
*[some] { $filename } — Noctua
|
||||
}
|
||||
|
||||
|
||||
## Menu entries
|
||||
menu-main = Menu
|
||||
menu-file-open = Open…
|
||||
menu-file-quit = Quit
|
||||
menu-view-zoom-in = Zoom In
|
||||
menu-view-zoom-out = Zoom Out
|
||||
menu-view-zoom-reset = Reset Zoom
|
||||
menu-view-zoom-fit = Fit to Window
|
||||
menu-view-flip-horizontal = Flip Horizontally
|
||||
menu-view-flip-vertical = Flip Vertically
|
||||
menu-view-rotate-cw = Rotate Clockwise
|
||||
menu-view-rotate-ccw = Rotate Counter-Clockwise
|
||||
|
||||
|
||||
## Footer / Status bar
|
||||
status-zoom-fit = Fit
|
||||
status-zoom-percent = { $percent }%
|
||||
status-doc-dimensions = { $width } × { $height }
|
||||
status-nav-position = { $current } / { $total }
|
||||
status-separator = |
|
||||
|
||||
|
||||
## Placeholders / Empty states
|
||||
no-document = No document loaded
|
||||
no-document-hint = Open a document to view
|
||||
|
||||
## Status / Info
|
||||
status-file-position = File { $current } / { $total }
|
||||
status-page-position = Page { $current } / { $total }
|
||||
|
||||
|
||||
## Labels
|
||||
label-zoom = Zoom
|
||||
label-tools = Tools
|
||||
label-crop = Crop
|
||||
label-scale = Scale
|
||||
label-page = Page
|
||||
label-pages = Pages
|
||||
|
||||
|
||||
## Loading states
|
||||
loading-metadata = Loading metadata…
|
||||
loading-thumbnails = Loading { $current } / { $total }…
|
||||
|
||||
|
||||
## Error messages
|
||||
error-failed-to-open = Failed to open "{ $path }"
|
||||
error-unsupported-format = Unsupported file format
|
||||
error-no-image-loaded = No image loaded
|
||||
|
||||
|
||||
## Properties panel
|
||||
panel-properties = Properties
|
||||
panel-actions = Actions
|
||||
|
||||
meta-section-file = File Information
|
||||
meta-section-exif = Camera Information
|
||||
meta-section-image = Image Information
|
||||
|
||||
## File metadata
|
||||
meta-filename = Name
|
||||
meta-format = Format
|
||||
meta-dimensions = Dimensions
|
||||
meta-filesize = Size
|
||||
meta-colortype = Color Type
|
||||
meta-path = Path
|
||||
meta-pages = Pages
|
||||
meta-current-page = Current Page
|
||||
|
||||
## Image metadata
|
||||
meta-width = Width
|
||||
meta-height = Height
|
||||
meta-depth = Bit Depth
|
||||
|
||||
## EXIF metadata
|
||||
meta-camera = Camera
|
||||
meta-datetime = Date Taken
|
||||
meta-exposure = Exposure
|
||||
meta-aperture = Aperture
|
||||
meta-iso = ISO { $iso }
|
||||
meta-focal = Focal Length
|
||||
meta-gps = GPS Location
|
||||
|
||||
## Action buttons
|
||||
action-set-wallpaper = Set as Wallpaper
|
||||
action-open-with = Open With…
|
||||
action-show-in-folder = Show in Folder
|
||||
|
||||
|
||||
## Navigation panel (thumbnails)
|
||||
nav-panel-title = Pages
|
||||
nav-panel-loading = Loading { $current } / { $total }…
|
||||
|
||||
|
||||
## Format panel
|
||||
format-section-title = Paper Format
|
||||
format-section-subtitle = Select paper size for export
|
||||
orientation-section-title = Orientation
|
||||
110
justfile
Normal file
110
justfile
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
# Name of the application binary (produced by the ui crate).
|
||||
name := 'noctua'
|
||||
# The unique ID of the application.
|
||||
appid := 'org.codeberg.wfx.Noctua'
|
||||
|
||||
# Path to root file system, which defaults to `/`.
|
||||
rootdir := ''
|
||||
# The prefix for the `/usr` directory.
|
||||
prefix := '/usr'
|
||||
# The location of the cargo target directory.
|
||||
cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
|
||||
|
||||
# Application's appstream metadata
|
||||
appdata := appid + '.metainfo.xml'
|
||||
# Application's desktop entry
|
||||
desktop := appid + '.desktop'
|
||||
# Application's icon.
|
||||
icon-svg := appid + '.svg'
|
||||
|
||||
# Install destinations
|
||||
base-dir := absolute_path(clean(rootdir / prefix))
|
||||
appdata-dst := base-dir / 'share' / 'metainfo' / appdata
|
||||
bin-dst := base-dir / 'bin' / name
|
||||
desktop-dst := base-dir / 'share' / 'applications' / desktop
|
||||
icons-dst := base-dir / 'share' / 'icons' / 'hicolor'
|
||||
icon-svg-dst := icons-dst / 'scalable' / 'apps' / icon-svg
|
||||
|
||||
# Default recipe
|
||||
default: build-release
|
||||
|
||||
# Runs `cargo clean`
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
# Removes vendored dependencies
|
||||
clean-vendor:
|
||||
rm -rf .cargo vendor vendor.tar
|
||||
|
||||
# `cargo clean` and removes vendored dependencies
|
||||
clean-dist: clean clean-vendor
|
||||
|
||||
# Compiles the entire workspace with debug profile
|
||||
build-debug *args:
|
||||
cargo build --workspace {{args}}
|
||||
|
||||
# Compiles with release profile
|
||||
build-release *args: (build-debug '--release' args)
|
||||
|
||||
# Compiles release profile with vendored dependencies
|
||||
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
|
||||
|
||||
# Runs clippy on the entire workspace
|
||||
check *args:
|
||||
cargo clippy --workspace --all-features {{args}} -- -W clippy::pedantic
|
||||
|
||||
# Runs clippy with JSON message format
|
||||
check-json: (check '--message-format=json')
|
||||
|
||||
# Runs tests on the entire workspace
|
||||
test *args:
|
||||
cargo test --workspace {{args}}
|
||||
|
||||
# Runs the COSMIC UI application
|
||||
run *args:
|
||||
env RUST_BACKTRACE=full cargo run --release -p noctua_ui {{args}}
|
||||
|
||||
# Runs the CLI test harness (core only, no UI deps)
|
||||
run-cli *args:
|
||||
env RUST_BACKTRACE=full cargo run --example cli -p noctua_core {{args}}
|
||||
|
||||
# Installs files
|
||||
install:
|
||||
install -Dm0755 {{ cargo-target-dir / 'release' / name }} {{bin-dst}}
|
||||
install -Dm0644 {{ 'resources' / desktop }} {{desktop-dst}}
|
||||
install -Dm0644 {{ 'resources' / appdata }} {{appdata-dst}}
|
||||
install -Dm0644 {{ 'resources' / 'icons' / 'hicolor' / 'scalable' / 'apps' / icon-svg }} {{icon-svg-dst}}
|
||||
|
||||
# Update icon cache and desktop database after install
|
||||
post-install:
|
||||
-gtk-update-icon-cache -f -t {{icons-dst}}
|
||||
-update-desktop-database {{base-dir / 'share' / 'applications'}}
|
||||
|
||||
# Uninstalls installed files
|
||||
uninstall:
|
||||
rm -f {{bin-dst}} {{desktop-dst}} {{appdata-dst}} {{icon-svg-dst}}
|
||||
-gtk-update-icon-cache -f -t {{icons-dst}}
|
||||
-update-desktop-database {{base-dir / 'share' / 'applications'}}
|
||||
|
||||
# Vendor dependencies locally
|
||||
vendor:
|
||||
mkdir -p .cargo
|
||||
cargo vendor | head -n -1 > .cargo/config.toml
|
||||
echo 'directory = "vendor"' >> .cargo/config.toml
|
||||
tar pcf vendor.tar vendor
|
||||
rm -rf vendor
|
||||
|
||||
# Extracts vendored dependencies
|
||||
vendor-extract:
|
||||
rm -rf vendor
|
||||
tar pxf vendor.tar
|
||||
|
||||
# Bump version in all crates, commit and tag
|
||||
tag version:
|
||||
find -type f -name Cargo.toml -exec sed -i '0,/^version/s/^version.*/version = "{{version}}"/' '{}' \; -exec git add '{}' \;
|
||||
cargo check --workspace
|
||||
cargo clean
|
||||
git add Cargo.lock
|
||||
git commit -m 'release: {{version}}'
|
||||
git commit --amend
|
||||
git tag -a {{version}} -m ''
|
||||
|
|
@ -0,0 +1,359 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="512"
|
||||
height="512"
|
||||
viewBox="0 0 512 512.00002"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||
sodipodi:docname="noctua.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="px"
|
||||
inkscape:zoom="0.70710678"
|
||||
inkscape:cx="371.93817"
|
||||
inkscape:cy="454.66966"
|
||||
inkscape:window-width="2151"
|
||||
inkscape:window-height="1268"
|
||||
inkscape:window-x="26"
|
||||
inkscape:window-y="23"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="layer1" /><defs
|
||||
id="defs1"><filter
|
||||
inkscape:collect="always"
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter51"
|
||||
x="-0.038666843"
|
||||
y="-0.043024329"
|
||||
width="1.0773337"
|
||||
height="1.0860487"><feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="8.526584"
|
||||
id="feGaussianBlur51" /></filter></defs><g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"><g
|
||||
id="g52"
|
||||
transform="translate(-3.0243593,1.4705614)"><g
|
||||
id="g51"
|
||||
transform="matrix(0.78387977,0,0,0.79126391,717.47018,-314.39252)"
|
||||
style="mix-blend-mode:normal;filter:url(#filter51)"><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:12;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -419.65433,901.91918 53.49446,-39.90981 35.37546,-128.04173 -57.3272,-10.62458 54.53538,-22.93687 -4.79183,-67.55245 c 0,0 -101.90345,-151.66632 -248.17903,-151.66632 -146.27558,0 -251.17903,156.66632 -251.17903,156.66632 l -1.79181,61.55245 52.53536,23.93687 -52.3272,25.62458 39.10583,114.03065 54.49448,43.90981 z"
|
||||
id="path27"
|
||||
sodipodi:nodetypes="cccccccccccccc" /><ellipse
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10.9304;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="ellipse27"
|
||||
cx="762.00842"
|
||||
cy="388.49088"
|
||||
rx="118.31967"
|
||||
ry="122.18041"
|
||||
transform="matrix(-0.8660254,0.5,0.5,0.8660254,0,0)" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:9.2322;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle27"
|
||||
cx="763.00842"
|
||||
cy="369.59668"
|
||||
r="101.55416"
|
||||
transform="matrix(-0.8660254,0.5,0.5,0.8660254,0,0)" /><g
|
||||
id="g28"
|
||||
transform="matrix(0.83587403,0.4825921,-0.4825921,0.83587403,33.580597,933.65116)"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none"><ellipse
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:11.3247;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="ellipse28"
|
||||
cx="-774.25"
|
||||
cy="190.75"
|
||||
rx="122.58766"
|
||||
ry="126.58766" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:9.56522;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle28"
|
||||
cx="-774.25"
|
||||
cy="169.37973"
|
||||
r="105.21739" /></g><path
|
||||
id="path28"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.88785;stroke-linecap:square"
|
||||
d="m -582.02574,955.5487 46.94932,-39.28617 c 2.02674,-1.69594 2.02674,-4.42659 0,-6.12253 l 49.69748,-61.45357 -35.55253,-19.95356 c -17.02674,-12.69595 -27.86062,-14.80883 -69.02121,-11.80767 -22.35449,0.81222 -38.69236,3.51123 -38.69236,3.51123 l -89.6468,33.45357 c -2.02674,1.69594 79.97326,60.67659 82,62.37253 l 46.94932,39.28617 c 2.02674,1.69594 5.29004,1.69594 7.31678,0 z"
|
||||
sodipodi:nodetypes="ccccccccccc" /><g
|
||||
id="g32"
|
||||
transform="matrix(0.60714286,0,0,0.60714286,-264.23676,600.72825)"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none"><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:13.0486;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle29"
|
||||
cx="-663.80597"
|
||||
cy="141.60011"
|
||||
r="56" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10.6602;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle30"
|
||||
cx="-664.05597"
|
||||
cy="141.35011"
|
||||
r="45.75" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.1068;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle31"
|
||||
cx="-660.80597"
|
||||
cy="136.60011"
|
||||
r="30.5" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:2.85437;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle32"
|
||||
cx="-657.55597"
|
||||
cy="129.85011"
|
||||
r="12.25" /></g><path
|
||||
id="path32"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:12;stroke-linecap:square;stroke-opacity:1"
|
||||
d="m -844.86876,512.94355 c 0,0 93.66733,39.64166 114.08139,47.72091 14.6246,5.21818 41.759,33.69181 47.39416,35.68323 6.10156,1.99164 13.64238,-2.0756 19.79311,-0.24154 4.6994,1.25378 68.17055,46.53654 68.17055,46.53654 2.80835,1.93942 7.28846,5.25496 7.49799,8.66147 l 3.21421,52.25444 c 0.20958,3.40649 -1.29711,7.92141 -4.31602,6.32935 l -230.4111,-121.51038 c -3.01886,-1.59204 -6.86858,-2.2072 -7.97268,-5.43662 l -21.76765,-63.66804 c -1.1041,-3.22941 1.28667,-7.90134 4.31604,-6.32936 z"
|
||||
sodipodi:nodetypes="scccssssssss" /><g
|
||||
id="g36"
|
||||
transform="matrix(1.3535534,0,0,1.3535534,152.94895,518.45065)"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none"><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:13.0486;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle33"
|
||||
cx="456.60492"
|
||||
cy="141.60011"
|
||||
r="56"
|
||||
transform="scale(-1,1)" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10.6602;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle34"
|
||||
cx="456.35492"
|
||||
cy="141.35011"
|
||||
r="45.75"
|
||||
transform="scale(-1,1)" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.1068;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle35"
|
||||
cx="459.60492"
|
||||
cy="136.60011"
|
||||
r="30.5"
|
||||
transform="scale(-1,1)" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:2.85437;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle36"
|
||||
cx="462.85492"
|
||||
cy="129.85011"
|
||||
r="12.25"
|
||||
transform="scale(-1,1)" /></g><path
|
||||
id="path36"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:12;stroke-linecap:square;stroke-opacity:1"
|
||||
d="m -324.90554,504.63387 c 0,0 -92.87343,41.46753 -113.12544,49.94482 -14.51967,5.50344 -41.09151,34.50275 -46.68661,36.60409 -6.0614,2.11069 -13.68038,-1.80817 -19.79405,0.14594 -4.67395,1.34553 -67.24657,47.86201 -67.24657,47.86201 -2.76985,1.99401 -7.18419,5.39662 -7.32701,8.80657 l -2.19077,52.30734 c -0.14285,3.40995 1.45197,7.8945 4.4391,6.24367 L -348.8484,580.5511 c 2.98712,-1.65083 6.82405,-2.34123 7.86474,-5.59164 l 20.51722,-64.08192 c 1.04068,-3.25041 -1.44109,-7.87464 -4.4391,-6.24367 z"
|
||||
sodipodi:nodetypes="scccssssssss" /><g
|
||||
id="g39"
|
||||
transform="matrix(1.3358771,-0.25249858,0.25249858,1.3358771,-891.08015,619.11458)"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none"><path
|
||||
id="path37"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 65.751448,168.93619 13.747104,8.20178 c 3.263955,1.94733 5.891615,5.73597 5.891615,8.49469 v 48.96654 c 0,2.75873 -2.62766,3.41194 -5.891615,1.46461 l -13.747104,-8.20178 c -3.263955,-1.94733 -5.891615,-5.73597 -5.891615,-8.49469 V 170.4008 c 0,-2.75873 2.62766,-3.41194 5.891615,-1.46461 z" /><path
|
||||
id="path38"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 92.001448,185.00099 14.747102,3.82218 c 3.60717,0.93491 5.92875,5.4664 5.89162,8.22487 l -0.75,55.71654 c -0.0371,2.75848 -2.62766,3.53228 -5.89162,1.73443 l -13.747102,-7.57218 c -3.263955,-1.79785 -5.878344,-5.46618 -5.891615,-8.22487 l -0.25,-51.96654 c -0.01327,-2.7587 2.284454,-2.66934 5.891615,-1.73443 z"
|
||||
sodipodi:nodetypes="sssssssss" /><path
|
||||
id="path39"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:8.29698;stroke-linecap:square"
|
||||
d="m 128.63706,190.89948 8.47588,7.21311 c 3.31861,2.82419 6.73967,6.8681 6.73967,10.05107 v 62.74702 c 0,3.18299 -3.32448,4.39645 -6.73967,1.68984 l -15.72588,-12.46311 c -3.41519,-2.70661 -6.73967,-6.6181 -6.73967,-9.80107 v -57.99702 c 0,-3.18299 10.67106,-4.26403 13.98967,-1.43984 z"
|
||||
sodipodi:nodetypes="sssssssss" /></g><g
|
||||
id="g42"
|
||||
transform="matrix(-1.3358771,-0.25249858,-0.25249858,1.3358771,-283.3154,618.49326)"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none"><path
|
||||
id="path40"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 65.751448,168.93619 13.747104,8.20178 c 3.263955,1.94733 5.891615,5.73597 5.891615,8.49469 v 48.96654 c 0,2.75873 -2.62766,3.41194 -5.891615,1.46461 l -13.747104,-8.20178 c -3.263955,-1.94733 -5.891615,-5.73597 -5.891615,-8.49469 V 170.4008 c 0,-2.75873 2.62766,-3.41194 5.891615,-1.46461 z" /><path
|
||||
id="path41"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 92.001448,185.00099 14.747102,3.82218 c 3.60717,0.93491 5.92875,5.4664 5.89162,8.22487 l -0.75,55.71654 c -0.0371,2.75848 -2.62766,3.53228 -5.89162,1.73443 l -13.747102,-7.57218 c -3.263955,-1.79785 -5.878344,-5.46618 -5.891615,-8.22487 l -0.25,-51.96654 c -0.01327,-2.7587 2.284454,-2.66934 5.891615,-1.73443 z"
|
||||
sodipodi:nodetypes="sssssssss" /><path
|
||||
id="path42"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:8.29698;stroke-linecap:square"
|
||||
d="m 131.76184,189.76981 7.01824,4.42333 c 3.68654,2.32349 5.07253,10.78755 5.07253,13.97052 v 62.74702 c 0,3.18299 -3.32448,4.39645 -6.73967,1.68984 l -15.72588,-12.46311 c -3.41519,-2.70661 -6.73967,-6.6181 -6.73967,-9.80107 v -57.99702 c 0,-3.18299 13.42791,-4.89299 17.11445,-2.56951 z"
|
||||
sodipodi:nodetypes="sssssssss" /></g><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -663.45584,835.09964 76,93 74,-94"
|
||||
id="path43"
|
||||
sodipodi:nodetypes="ccc" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:7;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -636.63681,683.04797 33.45534,95.55906"
|
||||
id="path44"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:8;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -529.62166,679.37557 -34.31316,72.98585"
|
||||
id="path45"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
id="path46"
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:9.85198;stroke-linecap:square"
|
||||
d="m -581.93031,719.70018 48.17402,62.55806 c 2.07961,2.57848 2.07961,6.73009 0,9.30853 l -50.38597,88.80066 c -2.07962,2.57849 -5.42804,2.57849 -7.50764,0 l -45.96207,-88.80066 c -2.07961,-2.57844 -2.07961,-6.73005 0,-9.30853 l 48.17402,-62.55806 c 2.07962,-2.57849 5.42802,-2.57849 7.50764,0 z"
|
||||
sodipodi:nodetypes="ccccccccc" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -586.54709,481.18742 7.46187,166.80988"
|
||||
id="path47" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -626.4966,619.42554 v -55.15433 l -24.04163,-24.04163 h -25.45585"
|
||||
id="path48" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M -650.53823,540.22958 V 491.06237"
|
||||
id="path49" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m -533.88643,607.06158 v -42.79037 l 24.04163,-24.04163 h 25.45585"
|
||||
id="path50"
|
||||
sodipodi:nodetypes="cccc" /><path
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M -509.8448,540.22958 V 497.56237"
|
||||
id="path51"
|
||||
sodipodi:nodetypes="cc" /></g><path
|
||||
style="fill:#9e6d45;fill-opacity:1;stroke:#35414a;stroke-width:8.96455;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 382.60794,392.14364 39.96282,-29.81446 26.4271,-95.65306 -42.82606,-7.93705 40.74044,-17.1349 -3.57972,-50.46479 c 0,0 -76.12656,-113.301713 -185.40115,-113.301713 -109.27459,0 -187.642299,117.036943 -187.642299,117.036943 l -1.338565,45.98251 39.246334,17.88195 -39.090829,19.14274 29.213862,85.18614 40.709877,32.80265 z"
|
||||
id="path19"
|
||||
sodipodi:nodetypes="cccccccccccccc" /><ellipse
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:8.16551;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="ellipse9"
|
||||
cx="-174.40848"
|
||||
cy="394.37506"
|
||||
rx="88.390236"
|
||||
ry="91.274391"
|
||||
transform="matrix(-0.8660254,0.5,0.5,0.8660254,0,0)" /><circle
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:6.89688;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle9"
|
||||
cx="-173.66142"
|
||||
cy="380.26022"
|
||||
r="75.865631"
|
||||
transform="matrix(-0.8660254,0.5,0.5,0.8660254,0,0)" /><g
|
||||
id="g4"
|
||||
transform="matrix(0.62443636,0.3605185,-0.3605185,0.62443636,721.19529,415.84889)"
|
||||
style="fill:#f1dfc0;fill-opacity:1"><ellipse
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:11.3247;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle4"
|
||||
cx="-774.25"
|
||||
cy="190.75"
|
||||
rx="122.58766"
|
||||
ry="126.58766" /><circle
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:9.56522;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path3"
|
||||
cx="-774.25"
|
||||
cy="169.37973"
|
||||
r="105.21739" /></g><path
|
||||
id="path16"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:5.89259;stroke-linecap:square"
|
||||
d="m 261.30902,432.20736 35.07331,-29.34857 c 1.51407,-1.26695 1.51407,-3.30687 0,-4.57381 l 37.1263,-45.90865 -26.55937,-14.90623 c -12.71976,-9.48446 -20.81317,-11.06287 -51.56202,-8.82087 -16.69984,0.60677 -28.90498,2.62305 -28.90498,2.62305 l -66.97028,24.99136 c -1.51407,1.26694 59.7437,45.3282 61.25777,46.59515 l 35.0733,29.34857 c 1.51407,1.26695 3.95191,1.26695 5.46597,0 z"
|
||||
sodipodi:nodetypes="ccccccccccc" /><g
|
||||
id="g11"
|
||||
transform="matrix(0.45356365,0,0,0.45356365,498.71202,167.14017)"><circle
|
||||
style="fill:#35414a;fill-opacity:1;stroke:none;stroke-width:13.0486;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="path1"
|
||||
cx="-663.80597"
|
||||
cy="141.60011"
|
||||
r="56" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10.6602;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle1"
|
||||
cx="-664.05597"
|
||||
cy="141.35011"
|
||||
r="45.75" /><circle
|
||||
style="fill:#35414a;fill-opacity:1;stroke:none;stroke-width:7.1068;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle2"
|
||||
cx="-660.80597"
|
||||
cy="136.60011"
|
||||
r="30.5" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:2.85437;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle3"
|
||||
cx="-657.55597"
|
||||
cy="129.85011"
|
||||
r="12.25" /></g><path
|
||||
id="rect1"
|
||||
style="fill:#9e6d45;fill-opacity:1;stroke:#35414a;stroke-width:8.96455;stroke-linecap:square;stroke-opacity:1"
|
||||
d="m 64.95319,101.56096 c 0,0 69.97381,29.61414 85.22405,35.64971 10.92525,3.89822 31.1959,25.16934 35.40562,26.65701 4.55815,1.48785 10.19149,-1.55056 14.78636,-0.18043 3.51067,0.93663 50.92654,34.76493 50.92654,34.76493 2.09797,1.44883 5.44482,3.9257 5.60135,6.47051 l 2.40116,39.03647 c 0.15656,2.54481 -0.969,5.91766 -3.22427,4.72832 L 83.946304,157.91363 c -2.255227,-1.18932 -5.131145,-1.64888 -5.955959,-4.06139 L 61.728909,106.28928 c -0.824813,-2.41252 0.961202,-5.90266 3.224281,-4.72832 z"
|
||||
sodipodi:nodetypes="scccssssssss" /><g
|
||||
id="g22"
|
||||
transform="matrix(1.0111667,0,0,1.0111667,810.36892,105.67502)"><circle
|
||||
style="fill:#35414a;fill-opacity:1;stroke:none;stroke-width:13.0486;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle5"
|
||||
cx="456.60492"
|
||||
cy="141.60011"
|
||||
r="56"
|
||||
transform="scale(-1,1)" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:10.6602;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle6"
|
||||
cx="456.35492"
|
||||
cy="141.35011"
|
||||
r="45.75"
|
||||
transform="scale(-1,1)" /><circle
|
||||
style="fill:#35414a;fill-opacity:1;stroke:none;stroke-width:7.1068;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle7"
|
||||
cx="459.60492"
|
||||
cy="136.60011"
|
||||
r="30.5"
|
||||
transform="scale(-1,1)" /><circle
|
||||
style="fill:#40f6f8;fill-opacity:1;stroke:none;stroke-width:2.85437;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="circle8"
|
||||
cx="462.85492"
|
||||
cy="129.85011"
|
||||
r="12.25"
|
||||
transform="scale(-1,1)" /></g><path
|
||||
id="path9"
|
||||
style="fill:#9e6d45;fill-opacity:1;stroke:#35414a;stroke-width:8.96455;stroke-linecap:square;stroke-opacity:1"
|
||||
d="m 453.38965,95.353247 c 0,0 -69.38073,30.978153 -84.50991,37.311073 -10.84687,4.11133 -30.69725,25.77515 -34.87705,27.34494 -4.52814,1.57679 -10.21987,-1.35078 -14.78707,0.10903 -3.49165,1.00517 -50.23628,35.75511 -50.23628,35.75511 -2.0692,1.48963 -5.36692,4.03153 -5.47361,6.57892 l -1.63661,39.07599 c -0.10671,2.54739 1.08469,5.89755 3.31621,4.6643 l 170.3179,-94.12571 c 2.23151,-1.23324 5.09788,-1.749 5.87532,-4.1772 l 15.32731,-47.87215 c 0.77743,-2.4282 -1.07656,-5.882717 -3.31621,-4.664303 z"
|
||||
sodipodi:nodetypes="scccssssssss" /><g
|
||||
id="g12"
|
||||
transform="matrix(0.99796166,-0.18862806,0.18862806,0.99796166,30.431155,180.8756)"
|
||||
style="fill:#f1dfc0;fill-opacity:1"><path
|
||||
id="rect11"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 65.751448,168.93619 13.747104,8.20178 c 3.263955,1.94733 5.891615,5.73597 5.891615,8.49469 v 48.96654 c 0,2.75873 -2.62766,3.41194 -5.891615,1.46461 l -13.747104,-8.20178 c -3.263955,-1.94733 -5.891615,-5.73597 -5.891615,-8.49469 V 170.4008 c 0,-2.75873 2.62766,-3.41194 5.891615,-1.46461 z" /><path
|
||||
id="path11"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 92.001448,185.00099 14.747102,3.82218 c 3.60717,0.93491 5.92875,5.4664 5.89162,8.22487 l -0.75,55.71654 c -0.0371,2.75848 -2.62766,3.53228 -5.89162,1.73443 l -13.747102,-7.57218 c -3.263955,-1.79785 -5.878344,-5.46618 -5.891615,-8.22487 l -0.25,-51.96654 c -0.01327,-2.7587 2.284454,-2.66934 5.891615,-1.73443 z"
|
||||
sodipodi:nodetypes="sssssssss" /><path
|
||||
id="path12"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:8.29698;stroke-linecap:square"
|
||||
d="m 128.63706,190.89948 8.47588,7.21311 c 3.31861,2.82419 6.73967,6.8681 6.73967,10.05107 v 62.74702 c 0,3.18299 -3.32448,4.39645 -6.73967,1.68984 l -15.72588,-12.46311 c -3.41519,-2.70661 -6.73967,-6.6181 -6.73967,-9.80107 v -57.99702 c 0,-3.18299 10.67106,-4.26403 13.98967,-1.43984 z"
|
||||
sodipodi:nodetypes="sssssssss" /></g><g
|
||||
id="g15"
|
||||
transform="matrix(-0.99796166,-0.18862806,-0.18862806,0.99796166,484.45939,180.41145)"
|
||||
style="fill:#f1dfc0;fill-opacity:1"><path
|
||||
id="path13"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 65.751448,168.93619 13.747104,8.20178 c 3.263955,1.94733 5.891615,5.73597 5.891615,8.49469 v 48.96654 c 0,2.75873 -2.62766,3.41194 -5.891615,1.46461 l -13.747104,-8.20178 c -3.263955,-1.94733 -5.891615,-5.73597 -5.891615,-8.49469 V 170.4008 c 0,-2.75873 2.62766,-3.41194 5.891615,-1.46461 z" /><path
|
||||
id="path14"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:7.22196;stroke-linecap:square"
|
||||
d="m 92.001448,185.00099 14.747102,3.82218 c 3.60717,0.93491 5.92875,5.4664 5.89162,8.22487 l -0.75,55.71654 c -0.0371,2.75848 -2.62766,3.53228 -5.89162,1.73443 l -13.747102,-7.57218 c -3.263955,-1.79785 -5.878344,-5.46618 -5.891615,-8.22487 l -0.25,-51.96654 c -0.01327,-2.7587 2.284454,-2.66934 5.891615,-1.73443 z"
|
||||
sodipodi:nodetypes="sssssssss" /><path
|
||||
id="path15"
|
||||
style="fill:#f1dfc0;fill-opacity:1;stroke:#35414a;stroke-width:8.29698;stroke-linecap:square"
|
||||
d="m 131.76184,189.76981 7.01824,4.42333 c 3.68654,2.32349 5.07253,10.78755 5.07253,13.97052 v 62.74702 c 0,3.18299 -3.32448,4.39645 -6.73967,1.68984 l -15.72588,-12.46311 c -3.41519,-2.70661 -6.73967,-6.6181 -6.73967,-9.80107 v -57.99702 c 0,-3.18299 13.42791,-4.89299 17.11445,-2.56951 z"
|
||||
sodipodi:nodetypes="sssssssss" /></g><path
|
||||
style="fill:none;fill-opacity:1;stroke:#35414a;stroke-width:7.47046;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 200.47699,342.22637 56.7755,69.47528 55.28141,-70.22232"
|
||||
id="path17"
|
||||
sodipodi:nodetypes="ccc" /><path
|
||||
style="fill:#9e6d45;fill-opacity:1;stroke:#35414a;stroke-width:5.22932;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 220.51204,228.63678 24.99268,71.38701"
|
||||
id="path20"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
style="fill:#9e6d45;fill-opacity:1;stroke:#35414a;stroke-width:5.97637;stroke-linecap:square;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 300.45728,225.89333 -25.63351,54.52379"
|
||||
id="path21"
|
||||
sodipodi:nodetypes="cc" /><path
|
||||
id="rect4"
|
||||
style="fill:#9e6d45;fill-opacity:1;stroke:#35414a;stroke-width:7.35988;stroke-linecap:square"
|
||||
d="m 261.38032,256.01767 35.98821,46.73375 c 1.55356,1.92624 1.55356,5.02768 0,6.9539 l -37.64064,66.33818 c -1.55357,1.92625 -4.055,1.92625 -5.60856,0 l -34.33578,-66.33818 c -1.55356,-1.92622 -1.55356,-5.02766 0,-6.9539 l 35.98821,-46.73375 c 1.55357,-1.92625 4.05498,-1.92625 5.60856,0 z"
|
||||
sodipodi:nodetypes="ccccccccc" /><path
|
||||
style="fill:#35414a;fill-opacity:1;stroke:#35414a;stroke-width:7.47046;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 257.93137,77.837667 5.57436,124.614653"
|
||||
id="path22" /><path
|
||||
style="fill:none;fill-opacity:1;stroke:#35414a;stroke-width:7.47046;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 228.08725,181.1079 v -41.20282 l -17.96021,-17.9602 h -19.01669"
|
||||
id="path23" /><path
|
||||
style="fill:none;fill-opacity:1;stroke:#35414a;stroke-width:7.47046;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 210.12704,121.94488 V 85.21471"
|
||||
id="path24" /><path
|
||||
style="fill:none;fill-opacity:1;stroke:#35414a;stroke-width:7.47046;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 297.2713,171.87146 v -31.96638 l 17.96021,-17.9602 h 19.01669"
|
||||
id="path25"
|
||||
sodipodi:nodetypes="cccc" /><path
|
||||
style="fill:none;fill-opacity:1;stroke:#35414a;stroke-width:7.47046;stroke-linecap:round;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 315.23151,121.94488 V 90.070509"
|
||||
id="path26"
|
||||
sodipodi:nodetypes="cc" /></g></g></svg>
|
||||
|
After Width: | Height: | Size: 25 KiB |
12
resources/org.codeberg.wfx.Noctua.desktop
Normal file
12
resources/org.codeberg.wfx.Noctua.desktop
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[Desktop Entry]
|
||||
Name=Noctua
|
||||
Comment=A wise document and image viewer for the COSMIC™ desktop
|
||||
Type=Application
|
||||
Icon=org.codeberg.wfx.Noctua
|
||||
Exec=noctua %F
|
||||
Terminal=false
|
||||
StartupNotify=true
|
||||
Categories=Graphics;Viewer;Utility;
|
||||
StartupWMClass=org.codeberg.wfx.Noctua
|
||||
Keywords=image;document;pdf;viewer;cosmic;
|
||||
MimeType=image/png;image/jpeg;image/gif;image/webp;image/bmp;image/tiff;image/svg+xml;application/pdf;
|
||||
62
resources/org.codeberg.wfx.Noctua.metainfo.xml
Normal file
62
resources/org.codeberg.wfx.Noctua.metainfo.xml
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
|
||||
<!-- resources/app.metainfo.xml -->
|
||||
<!-- AppStream metadata for software centers (e.g., COSMIC Store, GNOME Software, KDE Discover). -->
|
||||
<component type="desktop-application">
|
||||
<id>org.codeberg.wfx.Noctua</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0-or-later</project_license>
|
||||
<name>Noctua</name>
|
||||
<summary>A wise document and image viewer for the COSMIC™ desktop</summary>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
Noctua is a lightweight, keyboard-driven viewer for images, PDFs, and vector graphics.
|
||||
Built with Rust and libcosmic, it integrates seamlessly with COSMIC™ and GTK-based desktops.
|
||||
</p>
|
||||
</description>
|
||||
|
||||
<launchable type="desktop-id">org.codeberg.wfx.Noctua.desktop</launchable>
|
||||
|
||||
<url type="homepage">https://codeberg.org/wfx/noctua</url>
|
||||
<url type="bugtracker">https://codeberg.org/wfx/noctua/issues</url>
|
||||
<url type="vcs-browser">https://codeberg.org/wfx/noctua</url>
|
||||
|
||||
<provides>
|
||||
<binary>noctua</binary>
|
||||
<mediatype>image/png</mediatype>
|
||||
<mediatype>image/jpeg</mediatype>
|
||||
<mediatype>image/gif</mediatype>
|
||||
<mediatype>image/webp</mediatype>
|
||||
<mediatype>image/bmp</mediatype>
|
||||
<mediatype>image/tiff</mediatype>
|
||||
<mediatype>image/svg+xml</mediatype>
|
||||
<mediatype>application/pdf</mediatype>
|
||||
</provides>
|
||||
|
||||
<requires>
|
||||
<display_length compare="ge">360</display_length>
|
||||
</requires>
|
||||
|
||||
<supports>
|
||||
<control>keyboard</control>
|
||||
<control>pointing</control>
|
||||
<control>touch</control>
|
||||
</supports>
|
||||
|
||||
<categories>
|
||||
<category>Graphics</category>
|
||||
<category>Viewer</category>
|
||||
<category>Utility</category>
|
||||
</categories>
|
||||
|
||||
<keywords>
|
||||
<keyword>image</keyword>
|
||||
<keyword>document</keyword>
|
||||
<keyword>pdf</keyword>
|
||||
<keyword>viewer</keyword>
|
||||
<keyword>cosmic</keyword>
|
||||
</keywords>
|
||||
|
||||
<content_rating type="oars-1.1"/>
|
||||
</component>
|
||||
50
ui/Cargo.toml
Normal file
50
ui/Cargo.toml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# ui/Cargo.toml
|
||||
#
|
||||
# Binary crate for the Noctua COSMIC desktop application.
|
||||
|
||||
[package]
|
||||
name = "noctua"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Noctua – a document viewer for the COSMIC™ desktop"
|
||||
repository = "https://codeberg.org/wfx/noctua"
|
||||
authors = ["Wolfgang Morawetz <wfx@mailbox.org>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[dependencies]
|
||||
noctua_core = { path = "../core" }
|
||||
|
||||
# Logging
|
||||
log = "0.4"
|
||||
env_logger = "0.11"
|
||||
|
||||
# i18n / localization
|
||||
i18n-embed = { version = "0.16", features = [
|
||||
"fluent-system",
|
||||
"desktop-requester",
|
||||
] }
|
||||
i18n-embed-fl = "0.10"
|
||||
|
||||
# Resource embedding
|
||||
rust-embed = "8"
|
||||
|
||||
# Open files/URLs with the system default application
|
||||
open = "5"
|
||||
|
||||
# Async runtime (required by libcosmic)
|
||||
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
|
||||
|
||||
[dependencies.libcosmic]
|
||||
git = "https://github.com/pop-os/libcosmic.git"
|
||||
features = [
|
||||
"a11y",
|
||||
"about",
|
||||
"dbus-config",
|
||||
"multi-window",
|
||||
"single-instance",
|
||||
"tokio",
|
||||
"winit",
|
||||
"wayland",
|
||||
"wgpu",
|
||||
]
|
||||
8
ui/src/main.rs
Normal file
8
ui/src/main.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// src/main.rs
|
||||
//
|
||||
// Entry point for the Noctua COSMIC application.
|
||||
|
||||
fn main() {
|
||||
// TODO: Initialize the COSMIC application.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue