Move naturalLessThan function out of util/helpers.

This commit is contained in:
Andrius Štikonas 2015-03-28 16:55:06 +00:00
parent 0ce605e7bd
commit 8e5c1b1ebd
4 changed files with 34 additions and 10 deletions

View File

@ -50,6 +50,7 @@
#include <QApplication>
#include <QCloseEvent>
#include <QCollator>
#include <QDateTime>
#include <QFile>
#include <QFileDialog>
@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -0,0 +1,29 @@
/*************************************************************************
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
* *
* 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 <http://www.gnu.org/licenses/>.*
*************************************************************************/
#include "libpartitionmanagergui_export.h"
#if !defined(LIBPARTITIONMANAGERGUIEXPORT__H)
#define LIBPARTITIONMANAGERGUIEXPORT__H
#include <QtGlobal>
#if !defined(LIBKPMGUI_EXPORT)
#define LIBKPMGUI_EXPORT Q_DECL_EXPORT
#endif
#endif