mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-01 11:25:36 -04:00
[keyboard] Apply source formatting
- Move errant attribution line to the copyright headers; unsure of the year though. - Apply Calamares coding style.
This commit is contained in:
parent
118f9255fd
commit
cf51eb7aab
1 changed files with 50 additions and 36 deletions
|
@ -7,6 +7,8 @@
|
||||||
* by Roland Singer <roland@manjaro.org>
|
* by Roland Singer <roland@manjaro.org>
|
||||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
* Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
|
* Source by Georg Grabler <ggrabler@gmail.com>
|
||||||
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -52,7 +54,6 @@ static bool findSection( QFile& fh, const char* name )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//### Source by Georg Grabler <ggrabler@gmail.com> ###//
|
|
||||||
static KeyboardGlobal::ModelsMap parseKeyboardModels( const char* filepath )
|
static KeyboardGlobal::ModelsMap parseKeyboardModels( const char* filepath )
|
||||||
{
|
{
|
||||||
KeyboardGlobal::ModelsMap models;
|
KeyboardGlobal::ModelsMap models;
|
||||||
|
@ -60,14 +61,16 @@ static KeyboardGlobal::ModelsMap parseKeyboardModels(const char* filepath)
|
||||||
QFile fh( filepath );
|
QFile fh( filepath );
|
||||||
fh.open( QIODevice::ReadOnly );
|
fh.open( QIODevice::ReadOnly );
|
||||||
|
|
||||||
if (!fh.isOpen()) {
|
if ( !fh.isOpen() )
|
||||||
|
{
|
||||||
cDebug() << "X11 Keyboard model definitions not found!";
|
cDebug() << "X11 Keyboard model definitions not found!";
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modelsFound = findSection( fh, "! model" );
|
bool modelsFound = findSection( fh, "! model" );
|
||||||
// read the file until the end or until we break the loop
|
// read the file until the end or until we break the loop
|
||||||
while (modelsFound && !fh.atEnd()) {
|
while ( modelsFound && !fh.atEnd() )
|
||||||
|
{
|
||||||
QByteArray line = fh.readLine();
|
QByteArray line = fh.readLine();
|
||||||
|
|
||||||
// check if we start a new section
|
// check if we start a new section
|
||||||
|
@ -79,7 +82,8 @@ static KeyboardGlobal::ModelsMap parseKeyboardModels(const char* filepath)
|
||||||
rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
||||||
|
|
||||||
// insert into the model map
|
// insert into the model map
|
||||||
if (rx.indexIn(line) != -1) {
|
if ( rx.indexIn( line ) != -1 )
|
||||||
|
{
|
||||||
QString modelDesc = rx.cap( 2 );
|
QString modelDesc = rx.cap( 2 );
|
||||||
QString model = rx.cap( 1 );
|
QString model = rx.cap( 1 );
|
||||||
|
|
||||||
|
@ -103,14 +107,16 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts(const char* filepath)
|
||||||
QFile fh( filepath );
|
QFile fh( filepath );
|
||||||
fh.open( QIODevice::ReadOnly );
|
fh.open( QIODevice::ReadOnly );
|
||||||
|
|
||||||
if (!fh.isOpen()) {
|
if ( !fh.isOpen() )
|
||||||
|
{
|
||||||
cDebug() << "X11 Keyboard layout definitions not found!";
|
cDebug() << "X11 Keyboard layout definitions not found!";
|
||||||
return layouts;
|
return layouts;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool layoutsFound = findSection( fh, "! layout" );
|
bool layoutsFound = findSection( fh, "! layout" );
|
||||||
// read the file until the end or we break the loop
|
// read the file until the end or we break the loop
|
||||||
while ( layoutsFound && !fh.atEnd() ) {
|
while ( layoutsFound && !fh.atEnd() )
|
||||||
|
{
|
||||||
QByteArray line = fh.readLine();
|
QByteArray line = fh.readLine();
|
||||||
|
|
||||||
if ( line.startsWith( '!' ) )
|
if ( line.startsWith( '!' ) )
|
||||||
|
@ -120,7 +126,8 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts(const char* filepath)
|
||||||
rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
||||||
|
|
||||||
// insert into the layout map
|
// insert into the layout map
|
||||||
if (rx.indexIn(line) != -1) {
|
if ( rx.indexIn( line ) != -1 )
|
||||||
|
{
|
||||||
KeyboardGlobal::KeyboardInfo info;
|
KeyboardGlobal::KeyboardInfo info;
|
||||||
info.description = rx.cap( 2 );
|
info.description = rx.cap( 2 );
|
||||||
info.variants.insert( QObject::tr( "Default" ), "" );
|
info.variants.insert( QObject::tr( "Default" ), "" );
|
||||||
|
@ -135,7 +142,8 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts(const char* filepath)
|
||||||
|
|
||||||
bool variantsFound = findSection( fh, "! variant" );
|
bool variantsFound = findSection( fh, "! variant" );
|
||||||
// read the file until the end or until we break
|
// read the file until the end or until we break
|
||||||
while (variantsFound && !fh.atEnd() ) {
|
while ( variantsFound && !fh.atEnd() )
|
||||||
|
{
|
||||||
QByteArray line = fh.readLine();
|
QByteArray line = fh.readLine();
|
||||||
|
|
||||||
if ( line.startsWith( '!' ) )
|
if ( line.startsWith( '!' ) )
|
||||||
|
@ -145,11 +153,15 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts(const char* filepath)
|
||||||
rx.setPattern( "^\\s+(\\S+)\\s+(\\S+): (\\w.*)\n$" );
|
rx.setPattern( "^\\s+(\\S+)\\s+(\\S+): (\\w.*)\n$" );
|
||||||
|
|
||||||
// insert into the variants multimap, if the pattern matches
|
// insert into the variants multimap, if the pattern matches
|
||||||
if (rx.indexIn(line) != -1) {
|
if ( rx.indexIn( line ) != -1 )
|
||||||
if (layouts.find(rx.cap(2)) != layouts.end()) {
|
{
|
||||||
|
if ( layouts.find( rx.cap( 2 ) ) != layouts.end() )
|
||||||
|
{
|
||||||
// in this case we found an entry in the multimap, and add the values to the multimap
|
// in this case we found an entry in the multimap, and add the values to the multimap
|
||||||
layouts.find( rx.cap( 2 ) ).value().variants.insert( rx.cap( 3 ), rx.cap( 1 ) );
|
layouts.find( rx.cap( 2 ) ).value().variants.insert( rx.cap( 3 ), rx.cap( 1 ) );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// create a new map in the multimap - the value was not found.
|
// create a new map in the multimap - the value was not found.
|
||||||
KeyboardGlobal::KeyboardInfo info;
|
KeyboardGlobal::KeyboardInfo info;
|
||||||
info.description = rx.cap( 2 );
|
info.description = rx.cap( 2 );
|
||||||
|
@ -164,12 +176,14 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts(const char* filepath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KeyboardGlobal::LayoutsMap KeyboardGlobal::getKeyboardLayouts() {
|
KeyboardGlobal::LayoutsMap KeyboardGlobal::getKeyboardLayouts()
|
||||||
|
{
|
||||||
return parseKeyboardLayouts( XKB_FILE );
|
return parseKeyboardLayouts( XKB_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
KeyboardGlobal::ModelsMap KeyboardGlobal::getKeyboardModels() {
|
KeyboardGlobal::ModelsMap KeyboardGlobal::getKeyboardModels()
|
||||||
|
{
|
||||||
return parseKeyboardModels( XKB_FILE );
|
return parseKeyboardModels( XKB_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue