Introduce PMUtils

This commit is contained in:
Aurélien Gâteau 2014-06-30 15:03:29 +02:00
parent 6d0b3218f1
commit 4429a8fd63
4 changed files with 68 additions and 1 deletions

View File

@ -12,6 +12,7 @@ calamares_add_plugin( partition
PartitionModel.cpp
PartitionPage.cpp
PartitionViewStep.cpp
PMUtils.cpp
UI
PartitionPage.ui
LINK_LIBRARIES
@ -27,6 +28,7 @@ set( partview_SRCS
PartitionCoreModule.cpp
PartitionModel.cpp
PartitionPage.cpp
PMUtils.cpp
${calamares_SOURCE_DIR}/viewpages/AbstractPage.cpp
main.cpp
)

View File

@ -0,0 +1,33 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@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 <PMUtils.h>
// CalaPM
#include <core/partition.h>
namespace PMUtils
{
bool isPartitionFreeSpace( Partition* partition )
{
// FIXME: Check FS type instead
return partition->partitionPath().isEmpty();
}
} // namespace

View File

@ -0,0 +1,30 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@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 PMUTILS_H
#define PMUTILS_H
class Partition;
namespace PMUtils
{
bool isPartitionFreeSpace( Partition* );
}
#endif /* PMUTILS_H */

View File

@ -17,6 +17,8 @@
*/
#include <PartitionModel.h>
#include <PMUtils.h>
// CalaPM
#include <core/device.h>
#include <core/partition.h>
@ -61,7 +63,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
switch ( role )
{
case Qt::DisplayRole:
if ( partition->partitionPath().isEmpty() )
if ( PMUtils::isPartitionFreeSpace( partition ) )
{
return tr( "Free Space" );
}