Uic in GreetingPage.
This commit is contained in:
parent
6984f6a870
commit
0d89ba761a
@ -6,6 +6,7 @@ calamares_add_plugin( greeting
|
|||||||
GreetingViewStep.cpp
|
GreetingViewStep.cpp
|
||||||
GreetingPage.cpp
|
GreetingPage.cpp
|
||||||
UI
|
UI
|
||||||
|
GreetingPage.ui
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
|
@ -18,9 +18,11 @@
|
|||||||
|
|
||||||
#include "GreetingPage.h"
|
#include "GreetingPage.h"
|
||||||
|
|
||||||
|
#include "ui_GreetingPage.h"
|
||||||
|
#include "AboutDialog.h"
|
||||||
#include "CalamaresVersion.h"
|
#include "CalamaresVersion.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/CalamaresUtils.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
|
||||||
@ -29,20 +31,18 @@
|
|||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
|
|
||||||
|
|
||||||
GreetingPage::GreetingPage( QWidget* parent )
|
GreetingPage::GreetingPage( QWidget* parent )
|
||||||
: QWidget()
|
: QWidget( parent )
|
||||||
|
, ui( new Ui::GreetingPage )
|
||||||
{
|
{
|
||||||
QBoxLayout *mainLayout = new QHBoxLayout;
|
ui->setupUi( this );
|
||||||
setLayout( mainLayout );
|
|
||||||
|
|
||||||
QString defaultLocale = QLocale::system().name();
|
QString defaultLocale = QLocale::system().name();
|
||||||
|
|
||||||
m_languageWidget = new QListWidget( this );
|
|
||||||
mainLayout->addWidget( m_languageWidget );
|
|
||||||
{
|
{
|
||||||
foreach ( const QString& locale, QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') )
|
foreach ( const QString& locale, QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') )
|
||||||
{
|
{
|
||||||
@ -52,16 +52,16 @@ GreetingPage::GreetingPage( QWidget* parent )
|
|||||||
lang.append( QString( " (%1)" )
|
lang.append( QString( " (%1)" )
|
||||||
.arg( QLocale::countryToString( thisLocale.country() ) ) );
|
.arg( QLocale::countryToString( thisLocale.country() ) ) );
|
||||||
|
|
||||||
m_languageWidget->addItem( lang );
|
ui->languageWidget->addItem( lang );
|
||||||
m_languageWidget->item( m_languageWidget->count() - 1 )
|
ui->languageWidget->item( ui->languageWidget->count() - 1 )
|
||||||
->setData( Qt::UserRole, thisLocale );
|
->setData( Qt::UserRole, thisLocale );
|
||||||
if ( thisLocale.language() == QLocale( defaultLocale ).language() &&
|
if ( thisLocale.language() == QLocale( defaultLocale ).language() &&
|
||||||
thisLocale.country() == QLocale( defaultLocale ).country() )
|
thisLocale.country() == QLocale( defaultLocale ).country() )
|
||||||
m_languageWidget->setCurrentRow( m_languageWidget->count() - 1 );
|
ui->languageWidget->setCurrentRow( ui->languageWidget->count() - 1 );
|
||||||
}
|
}
|
||||||
m_languageWidget->sortItems();
|
ui->languageWidget->sortItems();
|
||||||
|
|
||||||
connect( m_languageWidget, &QListWidget::currentItemChanged,
|
connect( ui->languageWidget, &QListWidget::currentItemChanged,
|
||||||
this, [ & ]( QListWidgetItem *current, QListWidgetItem *previous )
|
this, [ & ]( QListWidgetItem *current, QListWidgetItem *previous )
|
||||||
{
|
{
|
||||||
QLocale selectedLocale = current->data( Qt::UserRole ).toLocale();
|
QLocale selectedLocale = current->data( Qt::UserRole ).toLocale();
|
||||||
@ -71,24 +71,19 @@ GreetingPage::GreetingPage( QWidget* parent )
|
|||||||
CalamaresUtils::installTranslator( selectedLocale.name(), qApp );
|
CalamaresUtils::installTranslator( selectedLocale.name(), qApp );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( m_languageWidget, &QListWidget::itemActivated,
|
connect( ui->languageWidget, &QListWidget::itemDoubleClicked,
|
||||||
this, []
|
this, []
|
||||||
{
|
{
|
||||||
Calamares::ViewManager::instance()->next();
|
Calamares::ViewManager::instance()->next();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_text = new QLabel( this );
|
ui->mainText->setAlignment( Qt::AlignCenter );
|
||||||
m_text->setAlignment( Qt::AlignCenter );
|
ui->mainText->setWordWrap( true );
|
||||||
m_text->setWordWrap( true );
|
ui->mainText->setOpenExternalLinks( true );
|
||||||
m_text->setOpenExternalLinks( true );
|
|
||||||
|
|
||||||
mainLayout->addStretch();
|
|
||||||
mainLayout->addWidget( m_text );
|
|
||||||
mainLayout->addStretch();
|
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_text->setText( tr( "<h1>Welcome to the %1 installer.</h1><br/>"
|
ui->mainText->setText( tr( "<h1>Welcome to the %1 installer.</h1><br/>"
|
||||||
"This program will ask you some questions and "
|
"This program will ask you some questions and "
|
||||||
"set up %2 on your computer." )
|
"set up %2 on your computer." )
|
||||||
.arg( Calamares::Branding::instance()->
|
.arg( Calamares::Branding::instance()->
|
||||||
@ -96,14 +91,42 @@ GreetingPage::GreetingPage( QWidget* parent )
|
|||||||
.arg( Calamares::Branding::instance()->
|
.arg( Calamares::Branding::instance()->
|
||||||
string( Calamares::Branding::ProductName ) ) );
|
string( Calamares::Branding::ProductName ) ) );
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information,
|
||||||
|
CalamaresUtils::Original,
|
||||||
|
2*QSize( CalamaresUtils::defaultFontHeight(),
|
||||||
|
CalamaresUtils::defaultFontHeight() ) ) );
|
||||||
|
connect( ui->aboutButton, &QPushButton::clicked,
|
||||||
|
this, [ this ]
|
||||||
|
{
|
||||||
|
QMessageBox::about( this,
|
||||||
|
tr( "About %1 installer" )
|
||||||
|
.arg( CALAMARES_APPLICATION_NAME ),
|
||||||
|
tr(
|
||||||
|
"<h1>%1</h1><br/>"
|
||||||
|
"<b>%2<br/>"
|
||||||
|
"for %3</b><br/><br/>"
|
||||||
|
"Copyright 2014 Teo Mrnjavac <teo@kde.org><br/>"
|
||||||
|
"Thanks to: Anke Boersma, Aurélien Gâteau, Kevin Kofler, Philip Müller, "
|
||||||
|
"Pier Luigi Fiorini and Rohan Garg.<br/><br/>"
|
||||||
|
"<a href=\"https://calamares.github.io/\">Calamares</a> "
|
||||||
|
"development is sponsored by <br/>"
|
||||||
|
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
||||||
|
"technologies for a better world."
|
||||||
|
)
|
||||||
|
.arg( CALAMARES_APPLICATION_NAME )
|
||||||
|
.arg( CALAMARES_VERSION )
|
||||||
|
.arg( Calamares::Branding::instance()->string(
|
||||||
|
Calamares::Branding::VersionedName ) ) );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GreetingPage::focusInEvent( QFocusEvent* e )
|
GreetingPage::focusInEvent( QFocusEvent* e )
|
||||||
{
|
{
|
||||||
if ( m_languageWidget )
|
if ( ui->languageWidget )
|
||||||
m_languageWidget->setFocus();
|
ui->languageWidget->setFocus();
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QLabel;
|
namespace Ui
|
||||||
class QListWidget;
|
{
|
||||||
|
class GreetingPage;
|
||||||
|
}
|
||||||
|
|
||||||
class GreetingPage : public QWidget
|
class GreetingPage : public QWidget
|
||||||
{
|
{
|
||||||
@ -34,8 +36,7 @@ protected:
|
|||||||
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QListWidget* m_languageWidget;
|
Ui::GreetingPage* ui;
|
||||||
QLabel* m_text;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GREETINGPAGE_H
|
#endif // GREETINGPAGE_H
|
||||||
|
146
src/modules/greeting/GreetingPage.ui
Normal file
146
src/modules/greeting/GreetingPage.ui
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>GreetingPage</class>
|
||||||
|
<widget class="QWidget" name="GreetingPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>593</width>
|
||||||
|
<height>400</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="languageWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="mainText">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>3</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"><Calamares welcome text></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="aboutButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>&About</string>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue
Block a user