From 8e5c1b1ebd6f4ffeed66ac04596dc9bdca968886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 28 Mar 2015 16:55:06 +0000 Subject: [PATCH] Move naturalLessThan function out of util/helpers. --- src/gui/mainwindow.cpp | 6 ++++- src/util/helpers.cpp | 8 ------- src/util/helpers.h | 1 - src/util/libpartitionmanagerguiexport.h | 29 +++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 src/util/libpartitionmanagerguiexport.h diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 8fb8283..a2e2592 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -1051,7 +1052,10 @@ void MainWindow::checkFileSystemSupport() foreach(const Device* d, operationStack().previewDevices()) supportList << checkSupportInNode(d->partitionTable()); - qSort(supportList.begin(), supportList.end(), naturalLessThan); + QCollator m_collator; + m_collator.setNumericMode(true); + m_collator.setCaseSensitivity(Qt::CaseSensitive); + std::sort(supportList.begin(), supportList.end(), [&m_collator](QString a, QString b) { return m_collator.compare(a, b) < 0; }); if (!supportList.isEmpty()) KMessageBox::information(this, diff --git a/src/util/helpers.cpp b/src/util/helpers.cpp index b4bb43c..661399b 100644 --- a/src/util/helpers.cpp +++ b/src/util/helpers.cpp @@ -111,14 +111,6 @@ bool caseInsensitiveLessThan(const QString& s1, const QString& s2) return s1.toLower() < s2.toLower(); } -bool naturalLessThan(const QString& s1, const QString& s2) -{ - QCollator c; - c.setNumericMode(true); - c.setCaseSensitivity(Qt::CaseSensitive); - return c.compare(s1, s2) < 0; -} - QIcon createFileSystemColor(FileSystem::Type type, quint32 size) { QPixmap pixmap(size, size); diff --git a/src/util/helpers.h b/src/util/helpers.h index 7387284..eb65f1b 100644 --- a/src/util/helpers.h +++ b/src/util/helpers.h @@ -34,7 +34,6 @@ LIBKPMCORE_EXPORT void registerMetaTypes(); LIBKPMCORE_EXPORT bool checkPermissions(); LIBKPMCORE_EXPORT bool caseInsensitiveLessThan(const QString& s1, const QString& s2); -LIBKPMCORE_EXPORT bool naturalLessThan(const QString& s1, const QString& s2); LIBKPMCORE_EXPORT QIcon createFileSystemColor(FileSystem::Type type, quint32 size); diff --git a/src/util/libpartitionmanagerguiexport.h b/src/util/libpartitionmanagerguiexport.h new file mode 100644 index 0000000..4fece1e --- /dev/null +++ b/src/util/libpartitionmanagerguiexport.h @@ -0,0 +1,29 @@ +/************************************************************************* + * Copyright (C) 2008 by Volker Lanz * + * * + * This program 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. * + * * + * This program 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 this program. If not, see .* + *************************************************************************/ + +#include "libpartitionmanagergui_export.h" + +#if !defined(LIBPARTITIONMANAGERGUIEXPORT__H) +#define LIBPARTITIONMANAGERGUIEXPORT__H + +#include + +#if !defined(LIBKPMGUI_EXPORT) + #define LIBKPMGUI_EXPORT Q_DECL_EXPORT +#endif + +#endif