File indexing completed on 2025-01-05 03:52:04

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-04-04
0007  * Description : a tool to generate HTML image galleries
0008  *
0009  * SPDX-FileCopyrightText: 2006-2010 by Aurelien Gateau <aurelien dot gateau at free dot fr>
0010  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "gallerynamehelper.h"
0017 
0018 namespace DigikamGenericHtmlGalleryPlugin
0019 {
0020 
0021 GalleryNameHelper::GalleryNameHelper()
0022 {
0023 }
0024 
0025 GalleryNameHelper::~GalleryNameHelper()
0026 {
0027 }
0028 
0029 QString GalleryNameHelper::makeNameUnique(const QString& name)
0030 {
0031     QString uname    = name;
0032     QString nameBase = name;
0033     int count        = 2;
0034 
0035     while (m_list.indexOf(uname) != -1)
0036     {
0037         uname = nameBase + QString::number(count);
0038         ++count;
0039     };
0040 
0041     m_list.append(uname);
0042 
0043     return uname;
0044 }
0045 
0046 } // namespace DigikamGenericHtmlGalleryPlugin