[Merge] with upstream
This commit is contained in:
commit
769be16fc6
29
.github/ISSUE_TEMPLATE.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#### Submission type
|
||||||
|
|
||||||
|
- [ ] Bug report
|
||||||
|
- [ ] Feature Request
|
||||||
|
|
||||||
|
|
||||||
|
#### Info regarding which version of Calamares is used, which Distribution
|
||||||
|
|
||||||
|
> …
|
||||||
|
|
||||||
|
#### Provide information on how the disks are set up, in detail, with full logs of commands issued
|
||||||
|
|
||||||
|
> …
|
||||||
|
|
||||||
|
#### What do you expect to have happen when Calamares installs?
|
||||||
|
|
||||||
|
> …
|
||||||
|
|
||||||
|
#### Describe the issue you encountered
|
||||||
|
|
||||||
|
> …
|
||||||
|
|
||||||
|
#### Steps to reproduce the problem
|
||||||
|
|
||||||
|
> …
|
||||||
|
|
||||||
|
#### Include the installation.log:
|
||||||
|
|
||||||
|
> …
|
@ -16,9 +16,7 @@ notifications:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- docker build -t calamares .
|
- docker build -t calamares .
|
||||||
- pip install pycodestyle
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- docker run -v $PWD:/src --tmpfs /build:rw,size=65536k calamares bash -lc "cd /build && cmake -DWEBVIEW_FORCE_WEBKIT=1 -DKDE_INSTALL_USE_QT_SYS_PATHS=ON /src && make -j2 && make install DESTDIR=/build/INSTALL_ROOT"
|
- docker run -v $PWD:/src --tmpfs /build:rw,size=65536k calamares bash -lc "cd /build && cmake -DWEBVIEW_FORCE_WEBKIT=1 -DKDE_INSTALL_USE_QT_SYS_PATHS=ON /src && make -j2 && make install DESTDIR=/build/INSTALL_ROOT"
|
||||||
- pycodestyle --exclude=thirdparty,.git $PWD
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|||||||
set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" )
|
set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" )
|
||||||
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" )
|
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" )
|
||||||
|
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-undefined-reinterpret-cast -Wno-global-constructors -Wno-exit-time-destructors" )
|
||||||
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
|
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
|
||||||
set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
|
set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG" )
|
set( CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG" )
|
||||||
|
@ -46,6 +46,7 @@ void
|
|||||||
ViewStepItem::appendChild( ProgressTreeItem* item )
|
ViewStepItem::appendChild( ProgressTreeItem* item )
|
||||||
{
|
{
|
||||||
Q_ASSERT( false );
|
Q_ASSERT( false );
|
||||||
|
Q_UNUSED( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
const char* k_usage =
|
static const char k_usage[] =
|
||||||
"Usage:\n"
|
"Usage:\n"
|
||||||
" CrashReporter <dumpFilePath> <linuxBacktracePath>\n";
|
" CrashReporter <dumpFilePath> <linuxBacktracePath>\n";
|
||||||
#else
|
#else
|
||||||
const char* k_usage =
|
static const char k_usage[] =
|
||||||
"Usage:\n"
|
"Usage:\n"
|
||||||
" CrashReporter <dumpFilePath>\n";
|
" CrashReporter <dumpFilePath>\n";
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,6 +40,8 @@ CppJob::setModuleInstanceKey( const QString& instanceKey )
|
|||||||
|
|
||||||
void
|
void
|
||||||
CppJob::setConfigurationMap( const QVariantMap& configurationMap )
|
CppJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{}
|
{
|
||||||
|
Q_UNUSED( configurationMap );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ofstream logfile;
|
static ofstream logfile;
|
||||||
static int s_threshold = -1;
|
static unsigned int s_threshold = 0;
|
||||||
QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
namespace Logger
|
namespace Logger
|
||||||
{
|
{
|
||||||
@ -49,20 +49,22 @@ namespace Logger
|
|||||||
static void
|
static void
|
||||||
log( const char* msg, unsigned int debugLevel, bool toDisk = true )
|
log( const char* msg, unsigned int debugLevel, bool toDisk = true )
|
||||||
{
|
{
|
||||||
if ( s_threshold < 0 )
|
if ( !s_threshold )
|
||||||
{
|
{
|
||||||
if ( qApp->arguments().contains( "--debug" ) ||
|
if ( qApp->arguments().contains( "--debug" ) ||
|
||||||
qApp->arguments().contains( "-d" ) )
|
qApp->arguments().contains( "-d" ) )
|
||||||
s_threshold = LOGVERBOSE;
|
s_threshold = LOGVERBOSE;
|
||||||
else
|
else
|
||||||
#ifdef QT_NO_DEBUG
|
#ifdef QT_NO_DEBUG
|
||||||
s_threshold = RELEASE_LEVEL_THRESHOLD;
|
s_threshold = RELEASE_LEVEL_THRESHOLD;
|
||||||
#else
|
#else
|
||||||
s_threshold = DEBUG_LEVEL_THRESHOLD;
|
s_threshold = DEBUG_LEVEL_THRESHOLD;
|
||||||
#endif
|
#endif
|
||||||
|
// Comparison is < threshold, below
|
||||||
|
++s_threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( toDisk || (int)debugLevel <= s_threshold )
|
if ( toDisk || debugLevel < s_threshold )
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &s_mutex );
|
QMutexLocker lock( &s_mutex );
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ log( const char* msg, unsigned int debugLevel, bool toDisk = true )
|
|||||||
logfile.flush();
|
logfile.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( debugLevel <= LOGEXTRA || (int)debugLevel <= s_threshold )
|
if ( debugLevel <= LOGEXTRA || debugLevel < s_threshold )
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &s_mutex );
|
QMutexLocker lock( &s_mutex );
|
||||||
|
|
||||||
@ -96,6 +98,8 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext& context, const QS
|
|||||||
{
|
{
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
|
Q_UNUSED( context );
|
||||||
|
|
||||||
QByteArray ba = msg.toUtf8();
|
QByteArray ba = msg.toUtf8();
|
||||||
const char* message = ba.constData();
|
const char* message = ba.constData();
|
||||||
|
|
||||||
@ -106,14 +110,12 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext& context, const QS
|
|||||||
log( message, LOGVERBOSE );
|
log( message, LOGVERBOSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case QtInfoMsg:
|
||||||
|
log( message, 1 );
|
||||||
|
break;
|
||||||
|
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
log( message, 0 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
log( message, 0 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
log( message, 0 );
|
log( message, 0 );
|
||||||
break;
|
break;
|
||||||
|
@ -52,7 +52,7 @@ namespace Logger
|
|||||||
virtual ~CDebug();
|
virtual ~CDebug();
|
||||||
};
|
};
|
||||||
|
|
||||||
DLLEXPORT void CalamaresLogHandler( QtMsgType type, const char* msg );
|
DLLEXPORT void CalamaresLogHandler( QtMsgType type, const QMessageLogContext& context, const QString& msg );
|
||||||
DLLEXPORT void setupLogfile();
|
DLLEXPORT void setupLogfile();
|
||||||
DLLEXPORT QString logFile();
|
DLLEXPORT QString logFile();
|
||||||
}
|
}
|
||||||
|
65
src/libcalamares/utils/Units.h
Normal file
65
src/libcalamares/utils/Units.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2017, Adriaan de Groot <groot@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 LIBCALAMARES_UTILS_UNITS_H
|
||||||
|
#define LIBCALAMARES_UTILS_UNITS_H
|
||||||
|
|
||||||
|
#include <QtCore/QIntegerForSize>
|
||||||
|
|
||||||
|
namespace CalamaresUtils
|
||||||
|
{
|
||||||
|
|
||||||
|
/** User defined literals, 1_MiB is 1 MibiByte (= 2^20 bytes) */
|
||||||
|
constexpr qint64 operator ""_MiB( unsigned long long m )
|
||||||
|
{
|
||||||
|
return qint64(m) * 1024 * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** User defined literals, 1_GiB is 1 GibiByte (= 2^30 bytes) */
|
||||||
|
constexpr qint64 operator ""_GiB( unsigned long long m )
|
||||||
|
{
|
||||||
|
return operator ""_MiB(m) * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr qint64 MiBtoBytes( unsigned long long m )
|
||||||
|
{
|
||||||
|
return operator ""_MiB( m );
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr qint64 GiBtoBytes( unsigned long long m )
|
||||||
|
{
|
||||||
|
return operator ""_GiB( m );
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr qint64 MiBToBytes( double m )
|
||||||
|
{
|
||||||
|
return qint64(m * 1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr qint64 GiBtoBytes( double m )
|
||||||
|
{
|
||||||
|
return qint64(m * 1024 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr int BytesToMiB( qint64 b )
|
||||||
|
{
|
||||||
|
return int( b / 1024 / 1024 );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
#endif
|
@ -165,7 +165,7 @@ ExecutionViewStep::appendJobModuleInstanceKey( const QString& instanceKey )
|
|||||||
void
|
void
|
||||||
ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
||||||
{
|
{
|
||||||
m_progressBar->setValue( percent * m_progressBar->maximum() );
|
m_progressBar->setValue( int( percent * m_progressBar->maximum() ) );
|
||||||
m_label->setText( message );
|
m_label->setText( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +100,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief instanceKey returns the instance key of this module.
|
* @brief instanceKey returns the instance key of this module.
|
||||||
* @return a string with the instance key.
|
* @return a string with the instance key.
|
||||||
* A module instance's instance key is modulename@instanceid.
|
* A module instance's instance key is modulename\@instanceid.
|
||||||
* @example "partition@partition" (default configuration) or
|
* For instance, "partition\@partition" (default configuration) or
|
||||||
* "locale@someconfig" (custom configuration)
|
* "locale\@someconfig" (custom configuration)
|
||||||
*/
|
*/
|
||||||
virtual QString instanceKey() const final;
|
virtual QString instanceKey() const final;
|
||||||
|
|
||||||
|
@ -219,14 +219,14 @@ ModuleManager::loadModules()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto findCustomInstance =
|
auto findCustomInstance =
|
||||||
[ customInstances ]( const QString& moduleName,
|
[ customInstances ]( const QString& module,
|
||||||
const QString& instanceId ) -> int
|
const QString& id) -> int
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < customInstances.count(); ++i )
|
for ( int i = 0; i < customInstances.count(); ++i )
|
||||||
{
|
{
|
||||||
auto thisInstance = customInstances[ i ];
|
auto thisInstance = customInstances[ i ];
|
||||||
if ( thisInstance.value( "module" ) == moduleName &&
|
if ( thisInstance.value( "module" ) == module &&
|
||||||
thisInstance.value( "id" ) == instanceId )
|
thisInstance.value( "id" ) == id )
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||||
*
|
*
|
||||||
* Originally from Tomahawk,
|
* Originally from Tomahawk,
|
||||||
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
@ -52,14 +53,14 @@ ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode )
|
|||||||
|
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
ImageRegistry::cacheKey( const QSize& size, float opacity, QColor tint )
|
ImageRegistry::cacheKey( const QSize& size, qreal opacity, QColor tint )
|
||||||
{
|
{
|
||||||
return size.width() * 100 + size.height() * 10 + ( opacity * 100.0 ) + tint.value();
|
return size.width() * 100 + size.height() * 10 + int( opacity * 100.0 ) + tint.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, QColor tint )
|
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, QColor tint )
|
||||||
{
|
{
|
||||||
QHash< qint64, QPixmap > subsubcache;
|
QHash< qint64, QPixmap > subsubcache;
|
||||||
QHash< int, QHash< qint64, QPixmap > > subcache;
|
QHash< int, QHash< qint64, QPixmap > > subcache;
|
||||||
@ -135,7 +136,7 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint )
|
ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, const QPixmap& pixmap, QColor tint )
|
||||||
{
|
{
|
||||||
// cDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding to image cache:" << image << size << mode;
|
// cDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding to image cache:" << image << size << mode;
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ public:
|
|||||||
explicit ImageRegistry();
|
explicit ImageRegistry();
|
||||||
|
|
||||||
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
|
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
|
||||||
QPixmap pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original, float opacity = 1.0, QColor tint = QColor( 0, 0, 0, 0 ) );
|
QPixmap pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original, qreal opacity = 1.0, QColor tint = QColor( 0, 0, 0, 0 ) );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qint64 cacheKey( const QSize& size, float opacity, QColor tint );
|
qint64 cacheKey( const QSize& size, qreal opacity, QColor tint );
|
||||||
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint );
|
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, const QPixmap& pixmap, QColor tint );
|
||||||
|
|
||||||
static ImageRegistry* s_instance;
|
static ImageRegistry* s_instance;
|
||||||
};
|
};
|
||||||
|
@ -37,6 +37,18 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
class LayoutItem : public QListWidgetItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString data;
|
||||||
|
|
||||||
|
virtual ~LayoutItem();
|
||||||
|
};
|
||||||
|
|
||||||
|
LayoutItem::~LayoutItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static QPersistentModelIndex
|
static QPersistentModelIndex
|
||||||
findLayout( const KeyboardLayoutModel* klm, const QString& currentLayout )
|
findLayout( const KeyboardLayoutModel* klm, const QString& currentLayout )
|
||||||
{
|
{
|
||||||
@ -54,7 +66,7 @@ findLayout( const KeyboardLayoutModel* klm, const QString& currentLayout )
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeyboardPage::KeyboardPage( QWidget* parent )
|
KeyboardPage::KeyboardPage( QWidget* parent )
|
||||||
: QWidget()
|
: QWidget( parent )
|
||||||
, ui( new Ui::Page_Keyboard )
|
, ui( new Ui::Page_Keyboard )
|
||||||
, m_keyboardPreview( new KeyBoardPreview( this ) )
|
, m_keyboardPreview( new KeyBoardPreview( this ) )
|
||||||
, m_defaultIndex( 0 )
|
, m_defaultIndex( 0 )
|
||||||
@ -369,6 +381,8 @@ static inline QStringList xkbmap_args( QStringList&& r, const QString& layout, c
|
|||||||
void
|
void
|
||||||
KeyboardPage::onListVariantCurrentItemChanged( QListWidgetItem* current, QListWidgetItem* previous )
|
KeyboardPage::onListVariantCurrentItemChanged( QListWidgetItem* current, QListWidgetItem* previous )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( previous );
|
||||||
|
|
||||||
QPersistentModelIndex layoutIndex = ui->listLayout->currentIndex();
|
QPersistentModelIndex layoutIndex = ui->listLayout->currentIndex();
|
||||||
LayoutItem* variantItem = dynamic_cast< LayoutItem* >( current );
|
LayoutItem* variantItem = dynamic_cast< LayoutItem* >( current );
|
||||||
|
|
||||||
|
@ -64,15 +64,9 @@ protected slots:
|
|||||||
QListWidgetItem* previous );
|
QListWidgetItem* previous );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class LayoutItem : public QListWidgetItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QString data;
|
|
||||||
KeyboardGlobal::KeyboardInfo info;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Guess a layout based on the split-apart locale
|
/// Guess a layout based on the split-apart locale
|
||||||
void guessLayout( const QStringList& langParts );
|
void guessLayout( const QStringList& langParts );
|
||||||
|
|
||||||
void updateVariants( const QPersistentModelIndex& currentItem,
|
void updateVariants( const QPersistentModelIndex& currentItem,
|
||||||
QString currentVariant = QString() );
|
QString currentVariant = QString() );
|
||||||
|
|
||||||
|
@ -134,9 +134,6 @@ KeyboardViewStep::onLeave()
|
|||||||
void
|
void
|
||||||
KeyboardViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
KeyboardViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
// Save the settings to the global settings for the SetKeyboardLayoutJob to use
|
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
|
||||||
|
|
||||||
if ( configurationMap.contains( "xOrgConfFileName" ) &&
|
if ( configurationMap.contains( "xOrgConfFileName" ) &&
|
||||||
configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String &&
|
configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String &&
|
||||||
!configurationMap.value( "xOrgConfFileName" ).toString().isEmpty() )
|
!configurationMap.value( "xOrgConfFileName" ).toString().isEmpty() )
|
||||||
|
@ -282,7 +282,7 @@ LocalePage::init( const QString& initialRegion,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_tzWidget->setCurrentLocation( "Europe", "Berlin" );
|
m_tzWidget->setCurrentLocation( "America", "New_York" );
|
||||||
}
|
}
|
||||||
emit m_tzWidget->locationChanged( m_tzWidget->getCurrentLocation() );
|
emit m_tzWidget->locationChanged( m_tzWidget->getCurrentLocation() );
|
||||||
|
|
||||||
|
@ -132,12 +132,12 @@ LocaleViewStep::fetchGeoIpTimezone()
|
|||||||
!map.value( "time_zone" ).toString().isEmpty() )
|
!map.value( "time_zone" ).toString().isEmpty() )
|
||||||
{
|
{
|
||||||
QString timezoneString = map.value( "time_zone" ).toString();
|
QString timezoneString = map.value( "time_zone" ).toString();
|
||||||
QStringList timezone = timezoneString.split( '/', QString::SkipEmptyParts );
|
QStringList tzParts = timezoneString.split( '/', QString::SkipEmptyParts );
|
||||||
if ( timezone.size() >= 2 )
|
if ( tzParts.size() >= 2 )
|
||||||
{
|
{
|
||||||
cDebug() << "GeoIP reporting" << timezoneString;
|
cDebug() << "GeoIP reporting" << timezoneString;
|
||||||
QString region = timezone.takeFirst();
|
QString region = tzParts.takeFirst();
|
||||||
QString zone = timezone.join( '/' );
|
QString zone = tzParts.join( '/' );
|
||||||
m_startingTimezone = qMakePair( region, zone );
|
m_startingTimezone = qMakePair( region, zone );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,8 +271,8 @@ LocaleViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_startingTimezone = qMakePair( QStringLiteral( "Europe" ),
|
m_startingTimezone = qMakePair( QStringLiteral( "America" ),
|
||||||
QStringLiteral( "Berlin" ) );
|
QStringLiteral( "New_York" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "localeGenPath" ) &&
|
if ( configurationMap.contains( "localeGenPath" ) &&
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "core/PartUtils.h"
|
#include "core/PartUtils.h"
|
||||||
|
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
|
#include "utils/Units.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
@ -36,25 +37,10 @@
|
|||||||
|
|
||||||
namespace PartitionActions
|
namespace PartitionActions
|
||||||
{
|
{
|
||||||
constexpr qint64 operator ""_MiB( unsigned long long m )
|
using CalamaresUtils::GiBtoBytes;
|
||||||
{
|
using CalamaresUtils::MiBtoBytes;
|
||||||
return m * static_cast< qint64 >( 1024 ) * 1024;
|
using CalamaresUtils::operator""_GiB;
|
||||||
}
|
using CalamaresUtils::operator""_MiB;
|
||||||
|
|
||||||
constexpr qint64 operator ""_GiB( unsigned long long m )
|
|
||||||
{
|
|
||||||
return operator ""_MiB(m) * static_cast< qint64 >( 1024 );
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr qint64 toMiB( unsigned long long m )
|
|
||||||
{
|
|
||||||
return operator ""_MiB( m );
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr qint64 toGiB( unsigned long long m )
|
|
||||||
{
|
|
||||||
return operator ""_GiB( m );
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64
|
qint64
|
||||||
swapSuggestion( const qint64 availableSpaceB )
|
swapSuggestion( const qint64 availableSpaceB )
|
||||||
@ -140,11 +126,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
empty_space_size = 1;
|
empty_space_size = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 firstFreeSector = toMiB(empty_space_size) / dev->logicalSize() + 1;
|
qint64 firstFreeSector = MiBtoBytes(empty_space_size) / dev->logicalSize() + 1;
|
||||||
|
|
||||||
if ( isEfi )
|
if ( isEfi )
|
||||||
{
|
{
|
||||||
qint64 lastSector = firstFreeSector + ( toMiB(uefisys_part_size) / dev->logicalSize() );
|
qint64 lastSector = firstFreeSector + ( MiBtoBytes(uefisys_part_size) / dev->logicalSize() );
|
||||||
core->createPartitionTable( dev, PartitionTable::gpt );
|
core->createPartitionTable( dev, PartitionTable::gpt );
|
||||||
Partition* efiPartition = KPMHelpers::createNewPartition(
|
Partition* efiPartition = KPMHelpers::createNewPartition(
|
||||||
dev->partitionTable(),
|
dev->partitionTable(),
|
||||||
@ -175,7 +161,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
|
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
|
||||||
suggestedSwapSizeB = swapSuggestion( availableSpaceB );
|
suggestedSwapSizeB = swapSuggestion( availableSpaceB );
|
||||||
qint64 requiredSpaceB =
|
qint64 requiredSpaceB =
|
||||||
toGiB( gs->value( "requiredStorageGB" ).toDouble() + 0.1 + 2.0 ) +
|
GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() + 0.1 + 2.0 ) +
|
||||||
suggestedSwapSizeB;
|
suggestedSwapSizeB;
|
||||||
|
|
||||||
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
|
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
|
||||||
|
@ -474,8 +474,7 @@ ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current,
|
|||||||
part->partitionPath(),
|
part->partitionPath(),
|
||||||
qRound64( part->used() * 1.1 ),
|
qRound64( part->used() * 1.1 ),
|
||||||
part->capacity() - requiredStorageB,
|
part->capacity() - requiredStorageB,
|
||||||
part->capacity() / 2,
|
part->capacity() / 2 );
|
||||||
*Calamares::Branding::ProductName );
|
|
||||||
|
|
||||||
if ( m_isEfi )
|
if ( m_isEfi )
|
||||||
setupEfiSystemPartitionSelector();
|
setupEfiSystemPartitionSelector();
|
||||||
|
@ -43,7 +43,7 @@ static const int LABELS_MARGIN = LABEL_PARTITION_SQUARE_MARGIN;
|
|||||||
static const int CORNER_RADIUS = 2;
|
static const int CORNER_RADIUS = 2;
|
||||||
|
|
||||||
|
|
||||||
QStringList
|
static QStringList
|
||||||
buildUnknownDisklabelTexts( Device* dev )
|
buildUnknownDisklabelTexts( Device* dev )
|
||||||
{
|
{
|
||||||
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
|
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
|
||||||
@ -54,7 +54,7 @@ buildUnknownDisklabelTexts( Device* dev )
|
|||||||
|
|
||||||
PartitionLabelsView::PartitionLabelsView( QWidget* parent )
|
PartitionLabelsView::PartitionLabelsView( QWidget* parent )
|
||||||
: QAbstractItemView( parent )
|
: QAbstractItemView( parent )
|
||||||
, canBeSelected( []( const QModelIndex& ) { return true; } )
|
, m_canBeSelected( []( const QModelIndex& ) { return true; } )
|
||||||
, m_extendedPartitionHidden( false )
|
, m_extendedPartitionHidden( false )
|
||||||
{
|
{
|
||||||
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||||
@ -100,6 +100,8 @@ PartitionLabelsView::sizeHint() const
|
|||||||
void
|
void
|
||||||
PartitionLabelsView::paintEvent( QPaintEvent* event )
|
PartitionLabelsView::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( event );
|
||||||
|
|
||||||
QPainter painter( viewport() );
|
QPainter painter( viewport() );
|
||||||
painter.fillRect( rect(), palette().window() );
|
painter.fillRect( rect(), palette().window() );
|
||||||
painter.setRenderHint( QPainter::Antialiasing );
|
painter.setRenderHint( QPainter::Antialiasing );
|
||||||
@ -292,7 +294,6 @@ PartitionLabelsView::drawLabels( QPainter* painter,
|
|||||||
!modl->device()->partitionTable() ) // No disklabel or unknown
|
!modl->device()->partitionTable() ) // No disklabel or unknown
|
||||||
{
|
{
|
||||||
QStringList texts = buildUnknownDisklabelTexts( modl->device() );
|
QStringList texts = buildUnknownDisklabelTexts( modl->device() );
|
||||||
QSize labelSize = sizeForLabel( texts );
|
|
||||||
QColor labelColor = ColorUtils::unknownDisklabelColor();
|
QColor labelColor = ColorUtils::unknownDisklabelColor();
|
||||||
drawLabel( painter, texts, labelColor, QPoint( rect.x(), rect.y() ), false /*can't be selected*/ );
|
drawLabel( painter, texts, labelColor, QPoint( rect.x(), rect.y() ), false /*can't be selected*/ );
|
||||||
}
|
}
|
||||||
@ -467,6 +468,8 @@ PartitionLabelsView::visualRect( const QModelIndex& idx ) const
|
|||||||
QRegion
|
QRegion
|
||||||
PartitionLabelsView::visualRegionForSelection( const QItemSelection& selection ) const
|
PartitionLabelsView::visualRegionForSelection( const QItemSelection& selection ) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( selection );
|
||||||
|
|
||||||
return QRegion();
|
return QRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,7 +519,7 @@ PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel )
|
|||||||
void
|
void
|
||||||
PartitionLabelsView::setSelectionFilter( SelectionFilter canBeSelected )
|
PartitionLabelsView::setSelectionFilter( SelectionFilter canBeSelected )
|
||||||
{
|
{
|
||||||
this->canBeSelected = canBeSelected;
|
m_canBeSelected = canBeSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -530,6 +533,9 @@ PartitionLabelsView::setExtendedPartitionHidden( bool hidden )
|
|||||||
QModelIndex
|
QModelIndex
|
||||||
PartitionLabelsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers )
|
PartitionLabelsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( cursorAction );
|
||||||
|
Q_UNUSED( modifiers );
|
||||||
|
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,6 +543,8 @@ PartitionLabelsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifier
|
|||||||
bool
|
bool
|
||||||
PartitionLabelsView::isIndexHidden( const QModelIndex& index ) const
|
PartitionLabelsView::isIndexHidden( const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( index );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +553,7 @@ void
|
|||||||
PartitionLabelsView::setSelection( const QRect& rect, QItemSelectionModel::SelectionFlags flags )
|
PartitionLabelsView::setSelection( const QRect& rect, QItemSelectionModel::SelectionFlags flags )
|
||||||
{
|
{
|
||||||
QModelIndex eventIndex = indexAt( rect.topLeft() );
|
QModelIndex eventIndex = indexAt( rect.topLeft() );
|
||||||
if ( canBeSelected( eventIndex ) )
|
if ( m_canBeSelected( eventIndex ) )
|
||||||
selectionModel()->select( eventIndex, flags );
|
selectionModel()->select( eventIndex, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +575,7 @@ PartitionLabelsView::mouseMoveEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
if ( oldHoveredIndex != m_hoveredIndex )
|
if ( oldHoveredIndex != m_hoveredIndex )
|
||||||
{
|
{
|
||||||
if ( m_hoveredIndex.isValid() && !canBeSelected( m_hoveredIndex ) )
|
if ( m_hoveredIndex.isValid() && !m_canBeSelected( m_hoveredIndex ) )
|
||||||
QGuiApplication::setOverrideCursor( Qt::ForbiddenCursor );
|
QGuiApplication::setOverrideCursor( Qt::ForbiddenCursor );
|
||||||
else
|
else
|
||||||
QGuiApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
@ -580,6 +588,8 @@ PartitionLabelsView::mouseMoveEvent( QMouseEvent* event )
|
|||||||
void
|
void
|
||||||
PartitionLabelsView::leaveEvent( QEvent* event )
|
PartitionLabelsView::leaveEvent( QEvent* event )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( event );
|
||||||
|
|
||||||
QGuiApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
if ( m_hoveredIndex.isValid() )
|
if ( m_hoveredIndex.isValid() )
|
||||||
{
|
{
|
||||||
@ -593,7 +603,7 @@ void
|
|||||||
PartitionLabelsView::mousePressEvent( QMouseEvent* event )
|
PartitionLabelsView::mousePressEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
QModelIndex candidateIndex = indexAt( event->pos() );
|
QModelIndex candidateIndex = indexAt( event->pos() );
|
||||||
if ( canBeSelected( candidateIndex ) )
|
if ( m_canBeSelected( candidateIndex ) )
|
||||||
QAbstractItemView::mousePressEvent( event );
|
QAbstractItemView::mousePressEvent( event );
|
||||||
else
|
else
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -83,7 +83,7 @@ private:
|
|||||||
QModelIndexList getIndexesToDraw( const QModelIndex& parent ) const;
|
QModelIndexList getIndexesToDraw( const QModelIndex& parent ) const;
|
||||||
QStringList buildTexts( const QModelIndex& index ) const;
|
QStringList buildTexts( const QModelIndex& index ) const;
|
||||||
|
|
||||||
SelectionFilter canBeSelected;
|
SelectionFilter m_canBeSelected;
|
||||||
bool m_extendedPartitionHidden;
|
bool m_extendedPartitionHidden;
|
||||||
|
|
||||||
QString m_customNewRootLabel;
|
QString m_customNewRootLabel;
|
||||||
|
@ -56,8 +56,8 @@
|
|||||||
PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_ui( new Ui_PartitionPage )
|
, m_ui( new Ui_PartitionPage )
|
||||||
, m_lastSelectedBootLoaderIndex(-1)
|
|
||||||
, m_core( core )
|
, m_core( core )
|
||||||
|
, m_lastSelectedBootLoaderIndex(-1)
|
||||||
, m_isEfi( false )
|
, m_isEfi( false )
|
||||||
{
|
{
|
||||||
m_isEfi = PartUtils::isEfiSystem();
|
m_isEfi = PartUtils::isEfiSystem();
|
||||||
@ -373,7 +373,7 @@ PartitionPage::updateFromCurrentDevice()
|
|||||||
// Establish connection here because selection model is destroyed when
|
// Establish connection here because selection model is destroyed when
|
||||||
// model changes
|
// model changes
|
||||||
connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
[ this ]( const QModelIndex&, const QModelIndex& )
|
||||||
{
|
{
|
||||||
updateButtons();
|
updateButtons();
|
||||||
} );
|
} );
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "core/ColorUtils.h"
|
#include "core/ColorUtils.h"
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
|
|
||||||
|
#include "utils/Units.h"
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ PartitionSizeController::doUpdateSpinBox()
|
|||||||
{
|
{
|
||||||
if ( !m_spinBox )
|
if ( !m_spinBox )
|
||||||
return;
|
return;
|
||||||
qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
|
int mbSize = CalamaresUtils::BytesToMiB( m_partition->length() * m_device->logicalSize() );
|
||||||
m_spinBox->setValue( mbSize );
|
m_spinBox->setValue( mbSize );
|
||||||
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
|
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
|
||||||
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value
|
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value
|
||||||
|
@ -34,18 +34,18 @@
|
|||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
|
||||||
static const int VIEW_HEIGHT = qMax( CalamaresUtils::defaultFontHeight() + 8, // wins out with big fonts
|
static const int VIEW_HEIGHT = qMax( CalamaresUtils::defaultFontHeight() + 8, // wins out with big fonts
|
||||||
(int)( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts
|
int( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts
|
||||||
static const int CORNER_RADIUS = 3;
|
static const int CORNER_RADIUS = 3;
|
||||||
static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 );
|
static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 );
|
||||||
|
|
||||||
PartitionSplitterWidget::PartitionSplitterWidget( QWidget* parent )
|
PartitionSplitterWidget::PartitionSplitterWidget( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_resizing( false )
|
|
||||||
, m_itemToResize( PartitionSplitterItem::null() )
|
, m_itemToResize( PartitionSplitterItem::null() )
|
||||||
, m_itemToResizeNext( PartitionSplitterItem::null() )
|
, m_itemToResizeNext( PartitionSplitterItem::null() )
|
||||||
, m_itemMinSize( 0 )
|
, m_itemMinSize( 0 )
|
||||||
, m_itemMaxSize( 0 )
|
, m_itemMaxSize( 0 )
|
||||||
, m_itemPrefSize( 0 )
|
, m_itemPrefSize( 0 )
|
||||||
|
, m_resizing( false )
|
||||||
, m_resizeHandleX( 0 )
|
, m_resizeHandleX( 0 )
|
||||||
, HANDLE_SNAP( QApplication::startDragDistance() )
|
, HANDLE_SNAP( QApplication::startDragDistance() )
|
||||||
, m_drawNestedPartitions( false )
|
, m_drawNestedPartitions( false )
|
||||||
@ -114,8 +114,7 @@ void
|
|||||||
PartitionSplitterWidget::setSplitPartition( const QString& path,
|
PartitionSplitterWidget::setSplitPartition( const QString& path,
|
||||||
qint64 minSize,
|
qint64 minSize,
|
||||||
qint64 maxSize,
|
qint64 maxSize,
|
||||||
qint64 preferredSize,
|
qint64 preferredSize )
|
||||||
const QString& newLabel )
|
|
||||||
{
|
{
|
||||||
cDebug() << Q_FUNC_INFO << "path:" << path
|
cDebug() << Q_FUNC_INFO << "path:" << path
|
||||||
<< "\nminSize:" << minSize
|
<< "\nminSize:" << minSize
|
||||||
@ -287,6 +286,8 @@ PartitionSplitterWidget::minimumSizeHint() const
|
|||||||
void
|
void
|
||||||
PartitionSplitterWidget::paintEvent( QPaintEvent* event )
|
PartitionSplitterWidget::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( event );
|
||||||
|
|
||||||
QPainter painter( this );
|
QPainter painter( this );
|
||||||
painter.fillRect( rect(), palette().window() );
|
painter.fillRect( rect(), palette().window() );
|
||||||
painter.setRenderHint( QPainter::Antialiasing );
|
painter.setRenderHint( QPainter::Antialiasing );
|
||||||
@ -400,6 +401,8 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
|
|||||||
void
|
void
|
||||||
PartitionSplitterWidget::mouseReleaseEvent( QMouseEvent* event )
|
PartitionSplitterWidget::mouseReleaseEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( event );
|
||||||
|
|
||||||
m_resizing = false;
|
m_resizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +494,7 @@ PartitionSplitterWidget::drawResizeHandle( QPainter* painter,
|
|||||||
|
|
||||||
painter->setRenderHint( QPainter::Antialiasing, false );
|
painter->setRenderHint( QPainter::Antialiasing, false );
|
||||||
painter->setPen( Qt::black );
|
painter->setPen( Qt::black );
|
||||||
painter->drawLine( x, 0, x, h - 1 );
|
painter->drawLine( x, 0, x, int(h) - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -511,20 +514,20 @@ PartitionSplitterWidget::drawPartitions( QPainter* painter,
|
|||||||
for ( int row = 0; row < count; ++row )
|
for ( int row = 0; row < count; ++row )
|
||||||
{
|
{
|
||||||
const PartitionSplitterItem& item = items[ row ];
|
const PartitionSplitterItem& item = items[ row ];
|
||||||
int width;
|
qreal width;
|
||||||
if ( row < count - 1 )
|
if ( row < count - 1 )
|
||||||
width = totalWidth * ( item.size / total );
|
width = totalWidth * ( item.size / total );
|
||||||
else
|
else
|
||||||
// Make sure we fill the last pixel column
|
// Make sure we fill the last pixel column
|
||||||
width = rect.right() - x + 1;
|
width = rect.right() - x + 1;
|
||||||
|
|
||||||
drawSection( painter, rect, x, width, item );
|
drawSection( painter, rect, x, int(width), item );
|
||||||
if ( !item.children.isEmpty() )
|
if ( !item.children.isEmpty() )
|
||||||
{
|
{
|
||||||
QRect subRect(
|
QRect subRect(
|
||||||
x + EXTENDED_PARTITION_MARGIN,
|
x + EXTENDED_PARTITION_MARGIN,
|
||||||
rect.y() + EXTENDED_PARTITION_MARGIN,
|
rect.y() + EXTENDED_PARTITION_MARGIN,
|
||||||
width - 2 * EXTENDED_PARTITION_MARGIN,
|
int(width) - 2 * EXTENDED_PARTITION_MARGIN,
|
||||||
rect.height() - 2 * EXTENDED_PARTITION_MARGIN
|
rect.height() - 2 * EXTENDED_PARTITION_MARGIN
|
||||||
);
|
);
|
||||||
drawPartitions( painter, subRect, item.children );
|
drawPartitions( painter, subRect, item.children );
|
||||||
@ -600,7 +603,7 @@ PartitionSplitterWidget::computeItemsVector( const QVector< PartitionSplitterIte
|
|||||||
PartitionSplitterItem thisItem = originalItems[ row ];
|
PartitionSplitterItem thisItem = originalItems[ row ];
|
||||||
QPair< QVector< PartitionSplitterItem >, qreal > pair = computeItemsVector( thisItem.children );
|
QPair< QVector< PartitionSplitterItem >, qreal > pair = computeItemsVector( thisItem.children );
|
||||||
thisItem.children = pair.first;
|
thisItem.children = pair.first;
|
||||||
thisItem.size = pair.second;
|
thisItem.size = qint64(pair.second);
|
||||||
items += thisItem;
|
items += thisItem;
|
||||||
total += thisItem.size;
|
total += thisItem.size;
|
||||||
}
|
}
|
||||||
@ -614,7 +617,7 @@ PartitionSplitterWidget::computeItemsVector( const QVector< PartitionSplitterIte
|
|||||||
if ( items[ row ].size < 0.01 * total ) // If this item is smaller than 1% of everything,
|
if ( items[ row ].size < 0.01 * total ) // If this item is smaller than 1% of everything,
|
||||||
{ // force its width to 1%.
|
{ // force its width to 1%.
|
||||||
adjustedTotal -= items[ row ].size;
|
adjustedTotal -= items[ row ].size;
|
||||||
items[ row ].size = 0.01 * total;
|
items[ row ].size = qint64(0.01 * total);
|
||||||
adjustedTotal += items[ row ].size;
|
adjustedTotal += items[ row ].size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,10 @@ struct PartitionSplitterItem
|
|||||||
qint64 size;
|
qint64 size;
|
||||||
Status status;
|
Status status;
|
||||||
|
|
||||||
QVector< PartitionSplitterItem > children;
|
using ChildVector = QVector< PartitionSplitterItem >;
|
||||||
|
ChildVector children;
|
||||||
|
|
||||||
static PartitionSplitterItem null() { return { QString(), QColor(), false, 0, Normal }; }
|
static PartitionSplitterItem null() { return { QString(), QColor(), false, 0, Normal, ChildVector() }; }
|
||||||
|
|
||||||
bool isNull() const { return itemPath.isEmpty() && size == 0 && status == Normal; }
|
bool isNull() const { return itemPath.isEmpty() && size == 0 && status == Normal; }
|
||||||
operator bool() const { return !isNull(); }
|
operator bool() const { return !isNull(); }
|
||||||
@ -59,8 +60,7 @@ public:
|
|||||||
void setSplitPartition( const QString& path,
|
void setSplitPartition( const QString& path,
|
||||||
qint64 minSize,
|
qint64 minSize,
|
||||||
qint64 maxSize,
|
qint64 maxSize,
|
||||||
qint64 preferredSize,
|
qint64 preferredSize );
|
||||||
const QString& newLabel );
|
|
||||||
|
|
||||||
qint64 splitPartitionSize() const;
|
qint64 splitPartitionSize() const;
|
||||||
qint64 newPartitionSize() const;
|
qint64 newPartitionSize() const;
|
||||||
|
@ -41,8 +41,6 @@
|
|||||||
|
|
||||||
typedef QHash<QString, QString> UuidForPartitionHash;
|
typedef QHash<QString, QString> UuidForPartitionHash;
|
||||||
|
|
||||||
static const char* UUID_DIR = "/dev/disk/by-uuid";
|
|
||||||
|
|
||||||
static UuidForPartitionHash
|
static UuidForPartitionHash
|
||||||
findPartitionUuids( QList < Device* > devices )
|
findPartitionUuids( QList < Device* > devices )
|
||||||
{
|
{
|
||||||
|
@ -145,8 +145,12 @@ MoveFileSystemJob::copyBlocks( Report& report, CopyTargetDevice& target, CopySou
|
|||||||
|
|
||||||
qint64 blocksCopied = 0;
|
qint64 blocksCopied = 0;
|
||||||
|
|
||||||
void* buffer = malloc( blockSize * source.sectorSize() );
|
Q_ASSERT( blockSize > 0 );
|
||||||
int percent = 0;
|
Q_ASSERT( source.sectorSize() > 0 );
|
||||||
|
Q_ASSERT( blockSize * source.sectorSize() > 0 );
|
||||||
|
|
||||||
|
void* buffer = malloc( size_t( blockSize * source.sectorSize() ) );
|
||||||
|
qint64 percent = 0;
|
||||||
|
|
||||||
while ( blocksCopied < blocksToCopy )
|
while ( blocksCopied < blocksToCopy )
|
||||||
{
|
{
|
||||||
@ -161,7 +165,7 @@ MoveFileSystemJob::copyBlocks( Report& report, CopyTargetDevice& target, CopySou
|
|||||||
if ( ++blocksCopied * 100 / blocksToCopy != percent )
|
if ( ++blocksCopied * 100 / blocksToCopy != percent )
|
||||||
{
|
{
|
||||||
percent = blocksCopied * 100 / blocksToCopy;
|
percent = blocksCopied * 100 / blocksToCopy;
|
||||||
progress( qreal( percent ) / 100. );
|
progress( percent / 100. );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include <PartitionJobTests.h>
|
#include <PartitionJobTests.h>
|
||||||
|
|
||||||
|
#include "utils/Units.h"
|
||||||
|
|
||||||
#include <jobs/CreatePartitionJob.h>
|
#include <jobs/CreatePartitionJob.h>
|
||||||
#include <jobs/CreatePartitionTableJob.h>
|
#include <jobs/CreatePartitionTableJob.h>
|
||||||
#include <jobs/ResizePartitionJob.h>
|
#include <jobs/ResizePartitionJob.h>
|
||||||
@ -36,9 +38,8 @@
|
|||||||
|
|
||||||
QTEST_GUILESS_MAIN( PartitionJobTests )
|
QTEST_GUILESS_MAIN( PartitionJobTests )
|
||||||
|
|
||||||
static const qint64 MB = 1024 * 1024;
|
|
||||||
|
|
||||||
using namespace Calamares;
|
using namespace Calamares;
|
||||||
|
using CalamaresUtils::operator""_MiB;
|
||||||
|
|
||||||
class PartitionMounter
|
class PartitionMounter
|
||||||
{
|
{
|
||||||
@ -79,7 +80,7 @@ generateTestData( qint64 size )
|
|||||||
// Fill the array explicitly to keep Valgrind happy
|
// Fill the array explicitly to keep Valgrind happy
|
||||||
for ( auto it = ba.data() ; it < ba.data() + size ; ++it )
|
for ( auto it = ba.data() ; it < ba.data() + size ; ++it )
|
||||||
{
|
{
|
||||||
*it = rand() % 256;
|
*it = char( rand() & 0xff );
|
||||||
}
|
}
|
||||||
return ba;
|
return ba;
|
||||||
}
|
}
|
||||||
@ -247,7 +248,7 @@ PartitionJobTests::testCreatePartition()
|
|||||||
|
|
||||||
freePartition = firstFreePartition( m_device->partitionTable() );
|
freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, 1 * MB);
|
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, 1_MiB);
|
||||||
Partition* partition1 = job->partition();
|
Partition* partition1 = job->partition();
|
||||||
QVERIFY( partition1 );
|
QVERIFY( partition1 );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
@ -255,7 +256,7 @@ PartitionJobTests::testCreatePartition()
|
|||||||
|
|
||||||
freePartition = firstFreePartition( m_device->partitionTable() );
|
freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::LinuxSwap, 1 * MB);
|
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::LinuxSwap, 1_MiB);
|
||||||
Partition* partition2 = job->partition();
|
Partition* partition2 = job->partition();
|
||||||
QVERIFY( partition2 );
|
QVERIFY( partition2 );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
@ -263,7 +264,7 @@ PartitionJobTests::testCreatePartition()
|
|||||||
|
|
||||||
freePartition = firstFreePartition( m_device->partitionTable() );
|
freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::Fat32, 1 * MB);
|
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::Fat32, 1_MiB);
|
||||||
Partition* partition3 = job->partition();
|
Partition* partition3 = job->partition();
|
||||||
QVERIFY( partition3 );
|
QVERIFY( partition3 );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
@ -288,7 +289,7 @@ PartitionJobTests::testCreatePartitionExtended()
|
|||||||
|
|
||||||
freePartition = firstFreePartition( m_device->partitionTable() );
|
freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, 10 * MB);
|
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Primary ), FileSystem::Ext4, 10_MiB);
|
||||||
Partition* partition1 = job->partition();
|
Partition* partition1 = job->partition();
|
||||||
QVERIFY( partition1 );
|
QVERIFY( partition1 );
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
@ -296,7 +297,7 @@ PartitionJobTests::testCreatePartitionExtended()
|
|||||||
|
|
||||||
freePartition = firstFreePartition( m_device->partitionTable() );
|
freePartition = firstFreePartition( m_device->partitionTable() );
|
||||||
QVERIFY( freePartition );
|
QVERIFY( freePartition );
|
||||||
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Extended ), FileSystem::Extended, 10 * MB);
|
job = newCreatePartitionJob( freePartition, PartitionRole( PartitionRole::Extended ), FileSystem::Extended, 10_MiB);
|
||||||
job->updatePreview();
|
job->updatePreview();
|
||||||
m_queue.enqueue( job_ptr( job ) );
|
m_queue.enqueue( job_ptr( job ) );
|
||||||
Partition* extendedPartition = job->partition();
|
Partition* extendedPartition = job->partition();
|
||||||
@ -341,7 +342,7 @@ PartitionJobTests::testResizePartition()
|
|||||||
QFETCH( int, newStartMB );
|
QFETCH( int, newStartMB );
|
||||||
QFETCH( int, newSizeMB );
|
QFETCH( int, newSizeMB );
|
||||||
|
|
||||||
const qint64 sectorForMB = MB / m_device->logicalSize();
|
const qint64 sectorForMB = 1_MiB / m_device->logicalSize();
|
||||||
|
|
||||||
qint64 oldFirst = sectorForMB * oldStartMB;
|
qint64 oldFirst = sectorForMB * oldStartMB;
|
||||||
qint64 oldLast = oldFirst + sectorForMB * oldSizeMB - 1;
|
qint64 oldLast = oldFirst + sectorForMB * oldSizeMB - 1;
|
||||||
@ -350,7 +351,7 @@ PartitionJobTests::testResizePartition()
|
|||||||
|
|
||||||
// Make the test data file smaller than the full size of the partition to
|
// Make the test data file smaller than the full size of the partition to
|
||||||
// accomodate for the file system overhead
|
// accomodate for the file system overhead
|
||||||
const QByteArray testData = generateTestData( ( qMin( oldSizeMB, newSizeMB ) ) * MB * 3 / 4 );
|
const QByteArray testData = generateTestData( CalamaresUtils::MiBtoBytes( qMin( oldSizeMB, newSizeMB ) ) * 3 / 4 );
|
||||||
const QString testName = "test.data";
|
const QString testName = "test.data";
|
||||||
|
|
||||||
// Setup: create the test partition
|
// Setup: create the test partition
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
|
#include "utils/Units.h"
|
||||||
|
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
|
||||||
@ -51,9 +53,10 @@
|
|||||||
RequirementsChecker::RequirementsChecker( QObject* parent )
|
RequirementsChecker::RequirementsChecker( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_widget( new QWidget() )
|
, m_widget( new QWidget() )
|
||||||
|
, m_requiredStorageGB( -1 )
|
||||||
|
, m_requiredRamGB( -1 )
|
||||||
, m_actualWidget( new CheckerWidget() )
|
, m_actualWidget( new CheckerWidget() )
|
||||||
, m_verdict( false )
|
, m_verdict( false )
|
||||||
, m_requiredStorageGB( -1 )
|
|
||||||
{
|
{
|
||||||
QBoxLayout* mainLayout = new QHBoxLayout;
|
QBoxLayout* mainLayout = new QHBoxLayout;
|
||||||
m_widget->setLayout( mainLayout );
|
m_widget->setLayout( mainLayout );
|
||||||
@ -77,12 +80,12 @@ RequirementsChecker::RequirementsChecker( QObject* parent )
|
|||||||
bool isRoot = false;
|
bool isRoot = false;
|
||||||
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowPreferredWidth) && (availableSize.height() >= CalamaresUtils::windowPreferredHeight);
|
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowPreferredWidth) && (availableSize.height() >= CalamaresUtils::windowPreferredHeight);
|
||||||
|
|
||||||
qint64 requiredStorageB = m_requiredStorageGB * 1073741824L; /*powers of 2*/
|
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGB);
|
||||||
cDebug() << "Need at least storage bytes:" << requiredStorageB;
|
cDebug() << "Need at least storage bytes:" << requiredStorageB;
|
||||||
if ( m_entriesToCheck.contains( "storage" ) )
|
if ( m_entriesToCheck.contains( "storage" ) )
|
||||||
enoughStorage = checkEnoughStorage( requiredStorageB );
|
enoughStorage = checkEnoughStorage( requiredStorageB );
|
||||||
|
|
||||||
qint64 requiredRamB = m_requiredRamGB * 1073741824L; /*powers of 2*/
|
qint64 requiredRamB = CalamaresUtils::GiBtoBytes(m_requiredRamGB);
|
||||||
cDebug() << "Need at least ram bytes:" << requiredRamB;
|
cDebug() << "Need at least ram bytes:" << requiredRamB;
|
||||||
if ( m_entriesToCheck.contains( "ram" ) )
|
if ( m_entriesToCheck.contains( "ram" ) )
|
||||||
enoughRam = checkEnoughRam( requiredRamB );
|
enoughRam = checkEnoughRam( requiredRamB );
|
||||||
|
Loading…
Reference in New Issue
Block a user