2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2014-06-11 13:37:10 +02:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2014-06-11 13:37:10 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2014-06-11 13:37:10 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
#ifndef WELCOMEPAGE_H
|
|
|
|
#define WELCOMEPAGE_H
|
2014-06-11 13:37:10 +02:00
|
|
|
|
2019-05-10 17:46:20 +02:00
|
|
|
#include "locale/LabelModel.h"
|
|
|
|
|
|
|
|
#include <QStyledItemDelegate>
|
2014-06-27 18:00:27 +02:00
|
|
|
#include <QWidget>
|
2014-06-11 13:37:10 +02:00
|
|
|
|
2014-11-20 09:40:55 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
2015-05-13 12:44:11 +02:00
|
|
|
class WelcomePage;
|
2014-11-20 09:40:55 +01:00
|
|
|
}
|
2014-11-10 12:40:00 +01:00
|
|
|
|
2017-12-02 15:56:03 +01:00
|
|
|
class CheckerContainer;
|
2020-03-10 22:44:48 +01:00
|
|
|
class Config;
|
2015-05-13 12:44:11 +02:00
|
|
|
class WelcomePage : public QWidget
|
2014-06-11 13:37:10 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2021-07-24 23:15:05 +02:00
|
|
|
WelcomePage( Config* config, QWidget* parent = nullptr );
|
2014-06-11 13:37:10 +02:00
|
|
|
|
2019-08-13 22:43:11 +02:00
|
|
|
enum class Button
|
|
|
|
{
|
|
|
|
Support,
|
|
|
|
Donate,
|
|
|
|
KnownIssues,
|
|
|
|
ReleaseNotes
|
|
|
|
};
|
|
|
|
|
|
|
|
/// @brief Configure the button @p n, to open @p url
|
|
|
|
void setupButton( Button b, const QString& url );
|
2019-08-13 22:29:01 +02:00
|
|
|
|
2019-05-31 16:59:38 +02:00
|
|
|
/// @brief Set international language-selector icon
|
2019-05-31 17:26:30 +02:00
|
|
|
void setLanguageIcon( QPixmap );
|
2015-04-02 12:28:40 +02:00
|
|
|
|
2019-04-18 23:17:49 +02:00
|
|
|
/// @brief Results of requirements checking
|
2017-12-02 15:56:03 +01:00
|
|
|
bool verdict() const;
|
|
|
|
|
2019-05-10 21:02:12 +02:00
|
|
|
/// @brief Change the language from an external source.
|
|
|
|
void externallySelectedLanguage( int row );
|
2019-08-13 22:29:01 +02:00
|
|
|
|
2020-03-10 22:44:48 +01:00
|
|
|
void init();
|
|
|
|
|
2019-08-29 11:06:55 +02:00
|
|
|
public slots:
|
|
|
|
void retranslate();
|
|
|
|
void showAboutBox();
|
|
|
|
|
2014-11-10 12:40:00 +01:00
|
|
|
protected:
|
2019-08-13 22:29:01 +02:00
|
|
|
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
2014-11-10 12:40:00 +01:00
|
|
|
|
|
|
|
private:
|
2019-04-18 23:17:49 +02:00
|
|
|
/// @brief Fill the list of languages with the available translations
|
2015-05-14 18:02:26 +02:00
|
|
|
void initLanguages();
|
2019-04-18 23:17:49 +02:00
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
Ui::WelcomePage* ui;
|
2017-12-02 15:56:03 +01:00
|
|
|
CheckerContainer* m_checkingWidget;
|
2019-08-13 22:29:01 +02:00
|
|
|
CalamaresUtils::Locale::LabelModel* m_languages;
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-03-25 11:41:39 +01:00
|
|
|
Config* m_conf;
|
2014-06-11 13:37:10 +02:00
|
|
|
};
|
|
|
|
|
2019-05-10 17:46:20 +02:00
|
|
|
/** @brief Delegate to display language information in two columns.
|
|
|
|
*
|
|
|
|
* Displays the native language name and the English language name.
|
|
|
|
*/
|
|
|
|
class LocaleTwoColumnDelegate : public QStyledItemDelegate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using QStyledItemDelegate::QStyledItemDelegate;
|
|
|
|
|
|
|
|
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
|
2019-08-13 22:29:01 +02:00
|
|
|
};
|
2019-05-10 17:46:20 +02:00
|
|
|
|
2019-08-13 22:29:01 +02:00
|
|
|
#endif // WELCOMEPAGE_H
|