#include "dolphin_generalsettings.h"
#include "configurepreviewplugindialog.h"
+#include "settings/serviceitemdelegate.h"
+#include "settings/servicemodel.h"
-#include <KConfigGroup>
+#include <KIO/PreviewJob>
#include <KLocalizedString>
#include <KServiceTypeTrader>
-#include <KService>
-#include <KIO/PreviewJob>
-#include <settings/serviceitemdelegate.h>
-#include <settings/servicemodel.h>
-
-#include <QCheckBox>
-#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QListView>
#include <QPainter>
-#include <QScrollBar>
#include <QShowEvent>
-#include <QSlider>
-#include <QSpinBox>
#include <QSortFilterProxyModel>
-#include <QVBoxLayout>
+#include <QSpinBox>
// default settings
namespace {
PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_initialized(false),
- m_listView(0),
+ m_listView(nullptr),
m_enabledPreviewPlugins(),
- m_remoteFileSizeBox(0)
+ m_remoteFileSizeBox(nullptr)
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
- QLabel* showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews for:"), this);
+ QLabel* showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews in the view for:"), this);
m_listView = new QListView(this);
QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(serviceModel);
proxyModel->setSortRole(Qt::DisplayRole);
+ proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
m_listView->setModel(proxyModel);
m_listView->setItemDelegate(delegate);
loadSettings();
connect(m_listView, &QListView::clicked, this, &PreviewsSettingsPage::changed);
- connect(m_remoteFileSizeBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &PreviewsSettingsPage::changed);
+ connect(m_remoteFileSizeBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &PreviewsSettingsPage::changed);
}
PreviewsSettingsPage::~PreviewsSettingsPage()
void PreviewsSettingsPage::loadSettings()
{
const KConfigGroup globalConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
- m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList());
- if (m_enabledPreviewPlugins.isEmpty()) {
- m_enabledPreviewPlugins = KIO::PreviewJob::defaultPlugins();
- }
+ m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins());
+
const qulonglong defaultRemotePreview = static_cast<qulonglong>(MaxRemotePreviewSize) * 1024 * 1024;
const qulonglong maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", defaultRemotePreview);
const int maxRemoteMByteSize = maxRemoteByteSize / (1024 * 1024);