-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
display the downloaded size in QgsFileDownloaderDialog
- Loading branch information
Showing
9 changed files
with
107 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsfileutils.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsFileUtils | ||
{ | ||
%Docstring | ||
Class for file utilities. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsfileutils.h" | ||
%End | ||
public: | ||
|
||
static QString representFileSize( qint64 bytes ); | ||
%Docstring | ||
Return the human size from bytes | ||
:rtype: str | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgsfileutils.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "qgsfileutils.h" | ||
#include <QObject> | ||
|
||
QString QgsFileUtils::representFileSize( qint64 bytes ) | ||
{ | ||
QStringList list; | ||
list << QObject::tr( "KB" ) << QObject::tr( "MB" ) << QObject::tr( "GB" ) << QObject::tr( "TB" ); | ||
|
||
QStringListIterator i( list ); | ||
QString unit = QObject::tr( "bytes" ); | ||
|
||
while ( bytes >= 1024.0 && i.hasNext() ) | ||
{ | ||
unit = i.next(); | ||
bytes /= 1024.0; | ||
} | ||
return QString( "%1 %2" ).arg( QString::number( bytes ), unit ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*************************************************************************** | ||
qgsfileutils.h | ||
--------------------------- | ||
begin : November 2017 | ||
copyright : (C) 2017 by Etienne Trimaille | ||
email : etienne dot trimaille at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* 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 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSFILEUTILS_H | ||
#define QGSFILEUTILS_H | ||
|
||
#include "qgis.h" | ||
|
||
/** | ||
* \ingroup core | ||
* \class QgsFileUtils | ||
* \brief Class for file utilities. | ||
* \since QGIS 3.0 | ||
*/ | ||
class CORE_EXPORT QgsFileUtils | ||
{ | ||
public: | ||
|
||
/** | ||
* Return the human size from bytes | ||
*/ | ||
static QString representFileSize( qint64 bytes ); | ||
|
||
}; | ||
|
||
#endif // QGSFILEUTILS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters