Compare commits
15 Commits
services-r
...
2.2.x-stab
Author | SHA1 | Date | |
---|---|---|---|
![]() |
90097f6bcb | ||
![]() |
d11b3fb4c8 | ||
![]() |
a30683ea61 | ||
![]() |
8577821884 | ||
![]() |
8161e77d1f | ||
![]() |
ad5226c8f7 | ||
![]() |
06bd19be90 | ||
![]() |
4c9faf3c98 | ||
![]() |
7947a06b60 | ||
![]() |
d4b84cd9a8 | ||
![]() |
3accd30ad1 | ||
![]() |
3b88b45c9f | ||
![]() |
14869bec6a | ||
![]() |
1161b169ee | ||
![]() |
a9b9fcd9ad |
@@ -101,7 +101,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX
|
||||
|
||||
set( CALAMARES_VERSION_MAJOR 2 )
|
||||
set( CALAMARES_VERSION_MINOR 2 )
|
||||
set( CALAMARES_VERSION_PATCH 2 )
|
||||
set( CALAMARES_VERSION_PATCH 3 )
|
||||
set( CALAMARES_VERSION_RC 0 )
|
||||
|
||||
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
|
||||
|
@@ -8,5 +8,5 @@ Exec=pkexec /usr/bin/calamares
|
||||
Comment=Calamares — System Installer
|
||||
Icon=calamares
|
||||
Terminal=false
|
||||
StartupNotify=false
|
||||
StartupNotify=true
|
||||
Categories=Qt;System;
|
||||
|
@@ -86,7 +86,11 @@ CalamaresApplication::init()
|
||||
setWindowIcon( QIcon( Calamares::Branding::instance()->
|
||||
imagePath( Calamares::Branding::ProductIcon ) ) );
|
||||
|
||||
cDebug() << "STARTUP: initQmlPath, initSettings, initBranding done";
|
||||
|
||||
initModuleManager(); //also shows main window
|
||||
|
||||
cDebug() << "STARTUP: initModuleManager: module init started";
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +332,9 @@ CalamaresApplication::initModuleManager()
|
||||
void
|
||||
CalamaresApplication::initView()
|
||||
{
|
||||
cDebug() << "STARTUP: initModuleManager: all modules init done";
|
||||
initJobQueue();
|
||||
cDebug() << "STARTUP: initJobQueue done";
|
||||
|
||||
m_mainwindow = new CalamaresWindow(); //also creates ViewManager
|
||||
|
||||
@@ -340,15 +346,19 @@ CalamaresApplication::initView()
|
||||
m_mainwindow->move(
|
||||
this->desktop()->availableGeometry().center() -
|
||||
m_mainwindow->rect().center() );
|
||||
|
||||
cDebug() << "STARTUP: CalamaresWindow created; loadModules started";
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalamaresApplication::initViewSteps()
|
||||
{
|
||||
cDebug() << "STARTUP: loadModules for all modules done";
|
||||
m_mainwindow->show();
|
||||
ProgressTreeModel* m = new ProgressTreeModel( this );
|
||||
ProgressTreeView::instance()->setModel( m );
|
||||
cDebug() << "STARTUP: Window now visible and ProgressTreeView populated";
|
||||
}
|
||||
|
||||
|
||||
|
@@ -6,6 +6,7 @@ calamares_add_plugin( keyboard
|
||||
SOURCES
|
||||
KeyboardViewStep.cpp
|
||||
KeyboardPage.cpp
|
||||
KeyboardLayoutModel.cpp
|
||||
SetKeyboardLayoutJob.cpp
|
||||
keyboardwidget/keyboardglobal.cpp
|
||||
keyboardwidget/keyboardpreview.cpp
|
||||
|
72
src/modules/keyboard/KeyboardLayoutModel.cpp
Normal file
72
src/modules/keyboard/KeyboardLayoutModel.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Calamares 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.
|
||||
*
|
||||
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "KeyboardLayoutModel.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
KeyboardLayoutModel::KeyboardLayoutModel( QObject* parent )
|
||||
: QAbstractListModel( parent )
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
KeyboardLayoutModel::rowCount( const QModelIndex& parent ) const
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
return m_layouts.count();
|
||||
}
|
||||
|
||||
|
||||
QVariant
|
||||
KeyboardLayoutModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() )
|
||||
return QVariant();
|
||||
|
||||
switch ( role )
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
return m_layouts.at( index.row() ).second.description;
|
||||
case KeyboardVariantsRole:
|
||||
return QVariant::fromValue( m_layouts.at( index.row() ).second.variants );
|
||||
case KeyboardLayoutKeyRole:
|
||||
return m_layouts.at( index.row() ).first;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KeyboardLayoutModel::init()
|
||||
{
|
||||
auto layouts = KeyboardGlobal::getKeyboardLayouts();
|
||||
for ( auto it = layouts.constBegin(); it != layouts.constEnd(); ++it )
|
||||
{
|
||||
m_layouts.append( qMakePair( it.key(), it.value() ) );
|
||||
}
|
||||
|
||||
std::stable_sort( m_layouts.begin(), m_layouts.end(), []( auto a, auto b )
|
||||
{
|
||||
return a.second.description < b.second.description;
|
||||
} );
|
||||
}
|
51
src/modules/keyboard/KeyboardLayoutModel.h
Normal file
51
src/modules/keyboard/KeyboardLayoutModel.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Calamares 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.
|
||||
*
|
||||
* Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KEYBOARDLAYOUTMODEL_H
|
||||
#define KEYBOARDLAYOUTMODEL_H
|
||||
|
||||
#include "keyboardwidget/keyboardglobal.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QMap>
|
||||
#include <QMetaType>
|
||||
|
||||
class KeyboardLayoutModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Roles : int
|
||||
{
|
||||
KeyboardVariantsRole = Qt::UserRole,
|
||||
KeyboardLayoutKeyRole
|
||||
};
|
||||
|
||||
KeyboardLayoutModel( QObject* parent = nullptr );
|
||||
|
||||
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
|
||||
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
QList< QPair< QString, KeyboardGlobal::KeyboardInfo > > m_layouts;
|
||||
};
|
||||
|
||||
#endif // KEYBOARDLAYOUTMODEL_H
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Portions from the Manjaro Installation Framework
|
||||
* by Roland Singer <roland@manjaro.org>
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ui_KeyboardPage.h"
|
||||
#include "keyboardwidget/keyboardpreview.h"
|
||||
#include "SetKeyboardLayoutJob.h"
|
||||
#include "KeyboardLayoutModel.h"
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
@@ -47,9 +48,9 @@ KeyboardPage::KeyboardPage( QWidget* parent )
|
||||
// Keyboard Preview
|
||||
ui->KBPreviewLayout->addWidget( m_keyboardPreview );
|
||||
|
||||
m_setxkbmapTimer.setSingleShot( true );
|
||||
|
||||
// Connect signals and slots
|
||||
connect( ui->listLayout, &QListWidget::currentItemChanged,
|
||||
this, &KeyboardPage::onListLayoutCurrentItemChanged );
|
||||
connect( ui->listVariant, &QListWidget::currentItemChanged,
|
||||
this, &KeyboardPage::onListVariantCurrentItemChanged );
|
||||
|
||||
@@ -150,37 +151,28 @@ KeyboardPage::init()
|
||||
|
||||
//### Layouts and Variants
|
||||
|
||||
KeyboardLayoutModel* klm = new KeyboardLayoutModel( this );
|
||||
ui->listLayout->setModel( klm );
|
||||
connect( ui->listLayout->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
this, &KeyboardPage::onListLayoutCurrentItemChanged );
|
||||
|
||||
// Block signals
|
||||
ui->listLayout->blockSignals( true );
|
||||
|
||||
QMap< QString, KeyboardGlobal::KeyboardInfo > layouts =
|
||||
KeyboardGlobal::getKeyboardLayouts();
|
||||
QMapIterator< QString, KeyboardGlobal::KeyboardInfo > li( layouts );
|
||||
LayoutItem* currentLayoutItem = nullptr;
|
||||
QPersistentModelIndex currentLayoutItem;
|
||||
|
||||
while ( li.hasNext() )
|
||||
for ( int i = 0; i < klm->rowCount(); ++i )
|
||||
{
|
||||
li.next();
|
||||
|
||||
LayoutItem* item = new LayoutItem();
|
||||
KeyboardGlobal::KeyboardInfo info = li.value();
|
||||
|
||||
item->setText( info.description );
|
||||
item->data = li.key();
|
||||
item->info = info;
|
||||
ui->listLayout->addItem( item );
|
||||
|
||||
// Find current layout index
|
||||
if ( li.key() == currentLayout )
|
||||
currentLayoutItem = item;
|
||||
QModelIndex idx = klm->index( i );
|
||||
if ( idx.isValid() &&
|
||||
idx.data( KeyboardLayoutModel::KeyboardLayoutKeyRole ).toString() == currentLayout )
|
||||
currentLayoutItem = idx;
|
||||
}
|
||||
|
||||
ui->listLayout->sortItems();
|
||||
|
||||
// Set current layout and variant
|
||||
if ( currentLayoutItem )
|
||||
if ( currentLayoutItem.isValid() )
|
||||
{
|
||||
ui->listLayout->setCurrentItem( currentLayoutItem );
|
||||
ui->listLayout->setCurrentIndex( currentLayoutItem );
|
||||
updateVariants( currentLayoutItem, currentVariant );
|
||||
}
|
||||
|
||||
@@ -189,8 +181,8 @@ KeyboardPage::init()
|
||||
|
||||
// Default to the first available layout if none was set
|
||||
// Do this after unblocking signals so we get the default variant handling.
|
||||
if ( !currentLayoutItem && ui->listLayout->count() > 0 )
|
||||
ui->listLayout->setCurrentRow( 0 );
|
||||
if ( !currentLayoutItem.isValid() && klm->rowCount() > 0 )
|
||||
ui->listLayout->setCurrentIndex( klm->index( 0 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +193,7 @@ KeyboardPage::prettyStatus() const
|
||||
status += tr( "Set keyboard model to %1.<br/>" )
|
||||
.arg( ui->comboBoxModel->currentText() );
|
||||
status += tr( "Set keyboard layout to %1/%2." )
|
||||
.arg( ui->listLayout->currentItem()->text() )
|
||||
.arg( ui->listLayout->currentIndex().data().toString() )
|
||||
.arg( ui->listVariant->currentItem()->text() );
|
||||
|
||||
return status;
|
||||
@@ -249,12 +241,15 @@ KeyboardPage::finalize()
|
||||
|
||||
|
||||
void
|
||||
KeyboardPage::updateVariants( LayoutItem* currentItem, QString currentVariant )
|
||||
KeyboardPage::updateVariants( const QPersistentModelIndex& currentItem,
|
||||
QString currentVariant )
|
||||
{
|
||||
// Block signals
|
||||
ui->listVariant->blockSignals( true );
|
||||
|
||||
QMap< QString, QString > variants = currentItem->info.variants;
|
||||
QMap< QString, QString > variants =
|
||||
currentItem.data( KeyboardLayoutModel::KeyboardVariantsRole )
|
||||
.value< QMap< QString, QString > >();
|
||||
QMapIterator< QString, QString > li( variants );
|
||||
LayoutItem* defaultItem = nullptr;
|
||||
|
||||
@@ -285,26 +280,27 @@ KeyboardPage::updateVariants( LayoutItem* currentItem, QString currentVariant )
|
||||
|
||||
|
||||
void
|
||||
KeyboardPage::onListLayoutCurrentItemChanged( QListWidgetItem* current, QListWidgetItem* previous )
|
||||
KeyboardPage::onListLayoutCurrentItemChanged( const QModelIndex& current,
|
||||
const QModelIndex& previous )
|
||||
{
|
||||
LayoutItem* item = dynamic_cast< LayoutItem* >( current );
|
||||
if ( !item )
|
||||
return;
|
||||
Q_UNUSED( previous );
|
||||
if ( !current.isValid() )
|
||||
return;
|
||||
|
||||
updateVariants( item );
|
||||
updateVariants( QPersistentModelIndex( current ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KeyboardPage::onListVariantCurrentItemChanged( QListWidgetItem* current, QListWidgetItem* previous )
|
||||
{
|
||||
LayoutItem* layoutItem = dynamic_cast< LayoutItem* >( ui->listLayout->currentItem() );
|
||||
QPersistentModelIndex layoutIndex = ui->listLayout->currentIndex();
|
||||
LayoutItem* variantItem = dynamic_cast< LayoutItem* >( current );
|
||||
|
||||
if ( !layoutItem || !variantItem )
|
||||
if ( !layoutIndex.isValid() || !variantItem )
|
||||
return;
|
||||
|
||||
QString layout = layoutItem->data;
|
||||
QString layout = layoutIndex.data( KeyboardLayoutModel::KeyboardLayoutKeyRole ).toString();
|
||||
QString variant = variantItem->data;
|
||||
|
||||
m_keyboardPreview->setLayout( layout );
|
||||
@@ -313,11 +309,22 @@ KeyboardPage::onListVariantCurrentItemChanged( QListWidgetItem* current, QListWi
|
||||
//emit checkReady();
|
||||
|
||||
// Set Xorg keyboard layout
|
||||
QProcess::execute( QString( "setxkbmap -layout \"%1\" -variant \"%2\"" )
|
||||
.arg( layout, variant ).toUtf8() );
|
||||
if ( m_setxkbmapTimer.isActive() )
|
||||
{
|
||||
m_setxkbmapTimer.stop();
|
||||
m_setxkbmapTimer.disconnect( this );
|
||||
}
|
||||
|
||||
connect( &m_setxkbmapTimer, &QTimer::timeout,
|
||||
this, [=]
|
||||
{
|
||||
QProcess::execute( QString( "setxkbmap -layout \"%1\" -variant \"%2\"" )
|
||||
.arg( layout, variant ).toUtf8() );
|
||||
cDebug() << "xkbmap selection changed to: " << layout << "-" << variant;
|
||||
} );
|
||||
m_setxkbmapTimer.start( QApplication::keyboardInputInterval() );
|
||||
|
||||
m_selectedLayout = layout;
|
||||
m_selectedVariant = variant;
|
||||
cDebug() << "xkbmap selection changed to: " << layout << "-" << variant;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Portions from the Manjaro Installation Framework
|
||||
* by Roland Singer <roland@manjaro.org>
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <QListWidgetItem>
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -55,8 +56,8 @@ public:
|
||||
void finalize();
|
||||
|
||||
protected slots:
|
||||
void onListLayoutCurrentItemChanged( QListWidgetItem* current,
|
||||
QListWidgetItem* previous );
|
||||
void onListLayoutCurrentItemChanged( const QModelIndex& current,
|
||||
const QModelIndex& previous );
|
||||
void onListVariantCurrentItemChanged( QListWidgetItem* current,
|
||||
QListWidgetItem* previous );
|
||||
|
||||
@@ -68,7 +69,8 @@ private:
|
||||
KeyboardGlobal::KeyboardInfo info;
|
||||
};
|
||||
|
||||
void updateVariants( LayoutItem* currentItem, QString currentVariant = QString() );
|
||||
void updateVariants( const QPersistentModelIndex& currentItem,
|
||||
QString currentVariant = QString() );
|
||||
|
||||
Ui::Page_Keyboard* ui;
|
||||
KeyBoardPreview* m_keyboardPreview;
|
||||
@@ -77,6 +79,7 @@ private:
|
||||
|
||||
QString m_selectedLayout;
|
||||
QString m_selectedVariant;
|
||||
QTimer m_setxkbmapTimer;
|
||||
};
|
||||
|
||||
#endif // KEYBOARDPAGE_H
|
||||
|
@@ -87,7 +87,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="keyboard.qrc">
|
||||
<normaloff>:/images/restore.png</normaloff>:/images/restore.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -106,7 +106,7 @@
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listLayout"/>
|
||||
<widget class="QListView" name="listLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listVariant"/>
|
||||
@@ -141,6 +141,8 @@
|
||||
<tabstop>LE_TestKeyboard</tabstop>
|
||||
<tabstop>buttonRestore</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="keyboard.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -225,41 +225,60 @@ LocalePage::init( const QString& initialRegion,
|
||||
}
|
||||
emit m_tzWidget->locationChanged( m_tzWidget->getCurrentLocation() );
|
||||
|
||||
// Fill in meaningful locale/charset lines from locale.gen
|
||||
// Some distros come with a meaningfully commented and easy to parse locale.gen,
|
||||
// and others ship a separate file /usr/share/i18n/SUPPORTED with a clean list of
|
||||
// supported locales. We first try that one, and if it doesn't exist, we fall back
|
||||
// to parsing the lines from locale.gen
|
||||
m_localeGenLines.clear();
|
||||
QFile localeGen( localeGenPath );
|
||||
QFile supported( "/usr/share/i18n/SUPPORTED" );
|
||||
QByteArray ba;
|
||||
if ( localeGen.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
|
||||
if ( supported.exists() &&
|
||||
supported.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
ba = localeGen.readAll();
|
||||
localeGen.close();
|
||||
ba = supported.readAll();
|
||||
supported.close();
|
||||
|
||||
foreach ( QByteArray line, ba.split( '\n' ) )
|
||||
{
|
||||
m_localeGenLines.append( QString::fromLatin1( line.simplified() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << "Cannot open file" << localeGenPath
|
||||
<< ". Assuming the supported languages are already built into "
|
||||
"the locale archive.";
|
||||
QProcess localeA;
|
||||
localeA.start( "locale", QStringList() << "-a" );
|
||||
localeA.waitForFinished();
|
||||
ba = localeA.readAllStandardOutput();
|
||||
}
|
||||
foreach ( QByteArray line, ba.split( '\n' ) )
|
||||
{
|
||||
if ( line.startsWith( "## " ) ||
|
||||
line.startsWith( "# " ) ||
|
||||
line.simplified() == "#" )
|
||||
continue;
|
||||
QFile localeGen( localeGenPath );
|
||||
if ( localeGen.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
ba = localeGen.readAll();
|
||||
localeGen.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
cDebug() << "Cannot open file" << localeGenPath
|
||||
<< ". Assuming the supported languages are already built into "
|
||||
"the locale archive.";
|
||||
QProcess localeA;
|
||||
localeA.start( "locale", QStringList() << "-a" );
|
||||
localeA.waitForFinished();
|
||||
ba = localeA.readAllStandardOutput();
|
||||
}
|
||||
foreach ( QByteArray line, ba.split( '\n' ) )
|
||||
{
|
||||
if ( line.startsWith( "## " ) ||
|
||||
line.startsWith( "# " ) ||
|
||||
line.simplified() == "#" )
|
||||
continue;
|
||||
|
||||
QString lineString = QString::fromLatin1( line.simplified() );
|
||||
if ( lineString.startsWith( "#" ) )
|
||||
lineString.remove( '#' );
|
||||
lineString = lineString.simplified();
|
||||
QString lineString = QString::fromLatin1( line.simplified() );
|
||||
if ( lineString.startsWith( "#" ) )
|
||||
lineString.remove( '#' );
|
||||
lineString = lineString.simplified();
|
||||
|
||||
if ( lineString.isEmpty() )
|
||||
continue;
|
||||
if ( lineString.isEmpty() )
|
||||
continue;
|
||||
|
||||
m_localeGenLines.append( lineString );
|
||||
m_localeGenLines.append( lineString );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ import libcalamares
|
||||
|
||||
def run():
|
||||
""" Create locale """
|
||||
us = '#en_US'
|
||||
en_us_locale = '#en_US'
|
||||
locale = libcalamares.globalstorage.value("lcLocale")
|
||||
|
||||
if not locale:
|
||||
@@ -50,23 +50,30 @@ def run():
|
||||
# always enable en_US
|
||||
with open("{!s}/etc/locale.gen".format(install_path), "w") as gen:
|
||||
for line in text:
|
||||
if us in line and line[0] == "#":
|
||||
if en_us_locale in line and line[0] == "#":
|
||||
# uncomment line
|
||||
line = line[1:]
|
||||
line = line[1:].lstrip()
|
||||
|
||||
if locale in line and line[0] == "#":
|
||||
# uncomment line
|
||||
line = line[1:]
|
||||
line = line[1:].lstrip()
|
||||
|
||||
gen.write(line)
|
||||
|
||||
libcalamares.utils.target_env_call(['locale-gen'])
|
||||
print('locale.gen done')
|
||||
|
||||
# write /etc/locale.conf
|
||||
locale_conf_path = os.path.join(install_path, "etc/locale.conf")
|
||||
|
||||
with open(locale_conf_path, "w") as locale_conf:
|
||||
locale_split = locale.split(' ')[0]
|
||||
locale_conf.write("LANG={!s}\n".format(locale_split))
|
||||
|
||||
# write /etc/default/locale if /etc/default exists and is a dir
|
||||
etc_default_path = os.path.join(install_path, "etc/default")
|
||||
if os.path.isdir(etc_default_path):
|
||||
with open(os.path.join(etc_default_path, "locale"), "w") as etc_default_locale:
|
||||
locale_split = locale.split(' ')[0]
|
||||
etc_default_locale.write("LANG={!s}\n".format(locale_split))
|
||||
|
||||
return None
|
||||
|
@@ -112,11 +112,12 @@ void
|
||||
PartitionCoreModule::init()
|
||||
{
|
||||
CoreBackend* backend = CoreBackendManager::self()->backend();
|
||||
auto devices = backend->scanDevices( true );
|
||||
QList< Device* > devices = backend->scanDevices( true );
|
||||
|
||||
// Remove the device which contains / from the list
|
||||
for ( auto it = devices.begin(); it != devices.end(); )
|
||||
if ( hasRootPartition( *it ) )
|
||||
for ( QList< Device* >::iterator it = devices.begin(); it != devices.end(); )
|
||||
if ( hasRootPartition( *it ) ||
|
||||
(*it)->deviceNode().startsWith( "/dev/zram") )
|
||||
it = devices.erase( it );
|
||||
else
|
||||
++it;
|
||||
|
@@ -54,6 +54,7 @@
|
||||
PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_ui( new Ui_PartitionPage )
|
||||
, m_lastSelectedBootLoaderIndex(-1)
|
||||
, m_core( core )
|
||||
{
|
||||
m_ui->setupUi( this );
|
||||
@@ -74,6 +75,11 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
{
|
||||
updateFromCurrentDevice();
|
||||
} );
|
||||
connect( m_ui->bootLoaderComboBox, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||
[ this ]( const QString& /* text */ )
|
||||
{
|
||||
m_lastSelectedBootLoaderIndex = m_ui->bootLoaderComboBox->currentIndex();
|
||||
} );
|
||||
|
||||
connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged,
|
||||
[ this ]( const QString& /* text */ )
|
||||
@@ -94,7 +100,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
m_ui->bootLoaderComboBox->hide();
|
||||
m_ui->label_3->hide();
|
||||
}
|
||||
|
||||
|
||||
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); )
|
||||
}
|
||||
|
||||
@@ -152,6 +158,9 @@ PartitionPage::onNewPartitionTableClicked()
|
||||
m_core->createPartitionTable( device, type );
|
||||
}
|
||||
delete dlg;
|
||||
// PartionModelReset isn't emmited after createPartitionTable, so we have to manually update
|
||||
// the bootLoader index after the reset.
|
||||
updateBootLoaderIndex();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -188,6 +197,7 @@ PartitionPage::onEditClicked()
|
||||
updatePartitionToCreate( model->device(), partition );
|
||||
else
|
||||
editExistingPartition( model->device(), partition );
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -217,7 +227,12 @@ PartitionPage::onRevertClicked()
|
||||
m_ui->deviceComboBox->setCurrentIndex( oldIndex );
|
||||
updateFromCurrentDevice();
|
||||
} ),
|
||||
[]{},
|
||||
[ this ]{
|
||||
m_lastSelectedBootLoaderIndex = -1;
|
||||
if( m_ui->bootLoaderComboBox->currentIndex() < 0 ) {
|
||||
m_ui->bootLoaderComboBox->setCurrentIndex( 0 );
|
||||
}
|
||||
},
|
||||
this );
|
||||
}
|
||||
|
||||
@@ -336,4 +351,14 @@ PartitionPage::onPartitionModelReset()
|
||||
{
|
||||
m_ui->partitionTreeView->expandAll();
|
||||
updateButtons();
|
||||
updateBootLoaderIndex();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionPage::updateBootLoaderIndex()
|
||||
{
|
||||
// set bootloader back to user selected index
|
||||
if ( m_lastSelectedBootLoaderIndex >= 0 && m_ui->bootLoaderComboBox->count() ) {
|
||||
m_ui->bootLoaderComboBox->setCurrentIndex( m_lastSelectedBootLoaderIndex );
|
||||
}
|
||||
}
|
||||
|
@@ -60,8 +60,10 @@ private:
|
||||
void editExistingPartition( Device*, Partition* );
|
||||
void updateBootLoaderInstallPath();
|
||||
void updateFromCurrentDevice();
|
||||
void updateBootLoaderIndex();
|
||||
|
||||
QMutex m_revertMutex;
|
||||
int m_lastSelectedBootLoaderIndex;
|
||||
};
|
||||
|
||||
#endif // PARTITIONPAGE_H
|
||||
|
@@ -52,13 +52,15 @@
|
||||
#include <QProcess>
|
||||
#include <QStackedWidget>
|
||||
#include <QTimer>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QFutureWatcher>
|
||||
|
||||
PartitionViewStep::PartitionViewStep( QObject* parent )
|
||||
: Calamares::ViewStep( parent )
|
||||
, m_widget( new QStackedWidget() )
|
||||
, m_core( new PartitionCoreModule( this ) )
|
||||
, m_core( nullptr )
|
||||
, m_choicePage( nullptr )
|
||||
, m_manualPartitionPage( new PartitionPage( m_core ) )
|
||||
, m_manualPartitionPage( nullptr )
|
||||
{
|
||||
m_widget->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
@@ -70,10 +72,21 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PartitionViewStep::initPartitionCoreModule()
|
||||
{
|
||||
Q_ASSERT( !m_core );
|
||||
m_core = new PartitionCoreModule( this );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PartitionViewStep::continueLoading()
|
||||
{
|
||||
Q_ASSERT( !m_choicePage );
|
||||
Q_ASSERT( !m_manualPartitionPage );
|
||||
|
||||
m_manualPartitionPage = new PartitionPage( m_core );
|
||||
m_choicePage = new ChoicePage();
|
||||
|
||||
m_choicePage->init( m_core );
|
||||
@@ -463,7 +476,20 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
gs->insert( "drawNestedPartitions", false );
|
||||
}
|
||||
|
||||
QTimer::singleShot( 0, this, &PartitionViewStep::continueLoading );
|
||||
// Now that we have the config, we load the PartitionCoreModule in the background
|
||||
// because it could take a while. Then when it's done, we can set up the widgets
|
||||
// and remove the spinner.
|
||||
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
||||
connect( watcher, &QFutureWatcher< void >::finished,
|
||||
this, [ this, watcher ]
|
||||
{
|
||||
continueLoading();
|
||||
watcher->deleteLater();
|
||||
} );
|
||||
|
||||
QFuture< void > future =
|
||||
QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
||||
watcher->setFuture( future );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -44,8 +44,6 @@ public:
|
||||
explicit PartitionViewStep( QObject* parent = 0 );
|
||||
virtual ~PartitionViewStep();
|
||||
|
||||
void continueLoading();
|
||||
|
||||
QString prettyName() const override;
|
||||
QWidget* createSummaryWidget() const override;
|
||||
|
||||
@@ -68,6 +66,9 @@ public:
|
||||
QList< Calamares::job_ptr > jobs() const override;
|
||||
|
||||
private:
|
||||
void initPartitionCoreModule();
|
||||
void continueLoading();
|
||||
|
||||
PartitionCoreModule* m_core;
|
||||
QStackedWidget* m_widget;
|
||||
ChoicePage* m_choicePage;
|
||||
|
Reference in New Issue
Block a user