File indexing completed on 2024-05-19 04:56:00

0001 /**
0002  * \file abstractfiledecorationprovider.h
0003  * Indirection for QFileIconProvider to use it without Gui and Widgets.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 9 Nov 2018
0008  *
0009  * Copyright (C) 2018  Urs Fleisch
0010  *
0011  * This file is part of Kid3.
0012  *
0013  * Kid3 is free software; you can redistribute it and/or modify
0014  * it under the terms of the GNU General Public License as published by
0015  * the Free Software Foundation; either version 2 of the License, or
0016  * (at your option) any later version.
0017  *
0018  * Kid3 is distributed in the hope that it will be useful,
0019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0021  * GNU General Public License for more details.
0022  *
0023  * You should have received a copy of the GNU General Public License
0024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0025  */
0026 
0027 #pragma once
0028 
0029 #include "kid3api.h"
0030 
0031 class QString;
0032 class QFileInfo;
0033 class QVariant;
0034 
0035 /**
0036  * Provides icons for the FileSystemModel.
0037  */
0038 class KID3_CORE_EXPORT AbstractFileDecorationProvider
0039 {
0040 public:
0041     virtual ~AbstractFileDecorationProvider();
0042 
0043     /** Section 0 headerData() for Qt::DecorationRole */
0044     virtual QVariant headerDecoration() const = 0;
0045     /** Computer icon. */
0046     virtual QVariant computerDecoration() const = 0;
0047     /** Folder icon. */
0048     virtual QVariant folderDecoration() const = 0;
0049     /** File icon. */
0050     virtual QVariant fileDecoration() const = 0;
0051     /** Icon for a file type. */
0052     virtual QVariant decoration(const QFileInfo &info) const = 0;
0053     /** Description for a file type. */
0054     virtual QString type(const QFileInfo &info) const;
0055 
0056     /** Default implementation for type(). */
0057     static QString fileTypeDescription(const QFileInfo &info);
0058 };