[libcalamares] Add a more extensible About message
- make the years easier to update without annoying translators - make the maintainers extensible.
This commit is contained in:
parent
f8345a09a2
commit
09255a1d9c
@ -24,6 +24,7 @@ set( OPTIONAL_PRIVATE_LIBRARIES "" )
|
|||||||
set( OPTIONAL_PUBLIC_LIBRARIES "" )
|
set( OPTIONAL_PUBLIC_LIBRARIES "" )
|
||||||
|
|
||||||
set( libSources
|
set( libSources
|
||||||
|
CalamaresAbout.cpp
|
||||||
CppJob.cpp
|
CppJob.cpp
|
||||||
GlobalStorage.cpp
|
GlobalStorage.cpp
|
||||||
Job.cpp
|
Job.cpp
|
||||||
|
73
src/libcalamares/CalamaresAbout.cpp
Normal file
73
src/libcalamares/CalamaresAbout.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* Calamares is Free Software: see the License-Identifier above.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CalamaresAbout.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
static const char s_header[]
|
||||||
|
= QT_TRANSLATE_NOOP( "AboutData", "<h1>%1</h1><br/><strong>%2<br/> for %3</strong><br/><br/>" );
|
||||||
|
|
||||||
|
static const char s_footer[]
|
||||||
|
= QT_TRANSLATE_NOOP( "AboutData",
|
||||||
|
"Thanks to <a href=\"https://calamares.io/team/\">the Calamares team</a> "
|
||||||
|
"and the <a href=\"https://www.transifex.com/calamares/calamares/\">Calamares "
|
||||||
|
"translators team</a>.<br/><br/>"
|
||||||
|
"<a href=\"https://calamares.io/\">Calamares</a> "
|
||||||
|
"development is sponsored by <br/>"
|
||||||
|
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
||||||
|
"Liberating Software." );
|
||||||
|
|
||||||
|
struct Maintainer
|
||||||
|
{
|
||||||
|
unsigned int start;
|
||||||
|
unsigned int end;
|
||||||
|
const char* name;
|
||||||
|
const char* email;
|
||||||
|
QString text() const
|
||||||
|
{
|
||||||
|
//: Copyright year-year Name <email-address>
|
||||||
|
return QCoreApplication::translate( "AboutData", "Copyright %1-%2 %3 <%4><br/>" )
|
||||||
|
.arg( start )
|
||||||
|
.arg( end )
|
||||||
|
.arg( name )
|
||||||
|
.arg( email );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr const Maintainer maintainers[] = {
|
||||||
|
{ 2014, 2017, "Teo Mrnjavac", "teo@kde.org" },
|
||||||
|
{ 2017, 2022, "Adriaan de Groot", "groot@kde.org" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static QString
|
||||||
|
aboutMaintainers()
|
||||||
|
{
|
||||||
|
return std::accumulate( std::cbegin( maintainers ),
|
||||||
|
std::cend( maintainers ),
|
||||||
|
QString(),
|
||||||
|
[]( QString& s, const Maintainer& m )
|
||||||
|
{
|
||||||
|
s += m.text();
|
||||||
|
return s;
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString
|
||||||
|
Calamares::aboutString()
|
||||||
|
{
|
||||||
|
return QCoreApplication::translate( "AboutData", s_header ) + aboutMaintainers()
|
||||||
|
+ QCoreApplication::translate( "AboutData", s_footer );
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString
|
||||||
|
Calamares::aboutStringUntranslated()
|
||||||
|
{
|
||||||
|
return QString( s_header ) + aboutMaintainers() + QString( s_footer );
|
||||||
|
}
|
23
src/libcalamares/CalamaresAbout.h
Normal file
23
src/libcalamares/CalamaresAbout.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* Calamares is Free Software: see the License-Identifier above.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CALAMARES_CALAMARESABOUT_H
|
||||||
|
#define CALAMARES_CALAMARESABOUT_H
|
||||||
|
|
||||||
|
#include "DllMacro.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
DLLEXPORT const QString aboutStringUntranslated();
|
||||||
|
DLLEXPORT const QString aboutString();
|
||||||
|
} // namespace Calamares
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user