This repository has been archived by the owner on Nov 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor some functionality into a utils header
Change-Id: I2dcb5d1044380cc7bb615bcddf3b2afeab1e79c9 Reviewed-on: https://kuesa-codereview.kdab.com/c/kuesa/kuesa/+/341 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
- Loading branch information
Showing
8 changed files
with
102 additions
and
45 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
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
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,46 @@ | ||
/* | ||
utils.cpp | ||
This file is part of Kuesa. | ||
Copyright (C) 2018-2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com | ||
Author: Juan Casafranca <juan.casafranca@kdab.com> | ||
Licensees holding valid proprietary KDAB Kuesa licenses may use this file in | ||
accordance with the Kuesa Enterprise License Agreement provided with the Software in the | ||
LICENSE.KUESA.ENTERPRISE file. | ||
Contact info@kdab.com if any conditions of this licensing are not clear to you. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero 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 Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "utils.h" | ||
|
||
namespace glTFEditor { | ||
namespace Utils { | ||
|
||
QString totalSizeString(int sizeInBytes) | ||
{ | ||
auto size = sizeInBytes / 1024.0; | ||
QString suffix(QStringLiteral(" KB")); | ||
if (size > 1024.) { | ||
size = size / 1024.; | ||
suffix = QStringLiteral(" MB"); | ||
} | ||
return QString::number(size, 'f', 2) + suffix; | ||
} | ||
|
||
} // namespace Utils | ||
} // namespace glTFEditor |
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,42 @@ | ||
/* | ||
utils.h | ||
This file is part of Kuesa. | ||
Copyright (C) 2018-2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com | ||
Author: Juan Casafranca <juan.casafranca@kdab.com> | ||
Licensees holding valid proprietary KDAB Kuesa licenses may use this file in | ||
accordance with the Kuesa Enterprise License Agreement provided with the Software in the | ||
LICENSE.KUESA.ENTERPRISE file. | ||
Contact info@kdab.com if any conditions of this licensing are not clear to you. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero 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 Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef GLTFEDITOR_UTILS_H | ||
#define GLTFEDITOR_UTILS_H | ||
|
||
#include <QString> | ||
|
||
namespace glTFEditor { | ||
namespace Utils { | ||
|
||
QString totalSizeString(int sizeInBytes); | ||
|
||
} // namespace Utils | ||
} // namespace glTFEditor | ||
|
||
#endif //GLTFEDITOR_UTILS_H |