2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
|
2020-10-24 22:15:02 +01:00
|
|
|
SPDX-FileCopyrightText: 2014-2020 Andrius Štikonas <andrius@stikonas.eu>
|
2020-09-16 00:35:12 +01:00
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2010-03-21 11:52:07 +00:00
|
|
|
|
|
|
|
#include "config/generalpagewidget.h"
|
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <backend/corebackendmanager.h>
|
|
|
|
#include <fs/filesystemfactory.h>
|
2010-03-21 11:52:07 +00:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <util/helpers.h>
|
2015-06-12 13:11:29 +01:00
|
|
|
#include "util/guihelpers.h"
|
2010-03-21 11:52:07 +00:00
|
|
|
|
2020-10-24 22:15:02 +01:00
|
|
|
#include <utility>
|
|
|
|
|
2010-03-21 11:52:07 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
GeneralPageWidget::GeneralPageWidget(QWidget* parent) :
|
2015-07-13 15:17:41 +01:00
|
|
|
QWidget(parent)
|
2010-03-21 11:52:07 +00:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
setupUi(this);
|
|
|
|
setupDialog();
|
2010-03-21 11:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FileSystem::Type GeneralPageWidget::defaultFileSystem() const
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
return FileSystem::typeForName(comboDefaultFileSystem().currentText());
|
2010-03-21 11:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralPageWidget::setDefaultFileSystem(FileSystem::Type t)
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
const int idx = comboDefaultFileSystem().findText(FileSystem::nameForType(t));
|
|
|
|
comboDefaultFileSystem().setCurrentIndex(idx != -1 ? idx : 0);
|
2010-03-21 11:52:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralPageWidget::setupDialog()
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
QStringList fsNames;
|
2016-08-09 14:57:33 +01:00
|
|
|
for (const auto &fs : FileSystemFactory::map())
|
2018-04-07 19:54:55 +01:00
|
|
|
if (fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Type::Extended && fs->type() != FileSystem::Type::Luks)
|
2016-05-18 19:20:24 +01:00
|
|
|
fsNames.append(fs->name());
|
2010-03-21 11:52:07 +00:00
|
|
|
|
2017-05-03 19:24:41 +01:00
|
|
|
std::sort(fsNames.begin(), fsNames.end(), caseInsensitiveLessThan);
|
2010-03-21 11:52:07 +00:00
|
|
|
|
2020-10-24 22:15:02 +01:00
|
|
|
for (const auto &fsName : std::as_const(fsNames))
|
2016-05-18 19:20:24 +01:00
|
|
|
comboDefaultFileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
|
2010-03-21 11:52:07 +00:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
setDefaultFileSystem(GuiHelpers::defaultFileSystem());
|
2014-05-29 02:45:36 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
kcfg_shredSource->setId(radioButton, 0);
|
|
|
|
kcfg_shredSource->setId(radioButton_2, 1);
|
|
|
|
radioButton->setChecked(Config::shredSource() == Config::EnumShredSource::random);
|
|
|
|
radioButton_2->setChecked(Config::shredSource() == Config::EnumShredSource::zeros);
|
2010-03-21 11:52:07 +00:00
|
|
|
}
|