2022-05-21 10:44:39 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.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 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2022-02-13 20:08:18 +08:00
|
|
|
#ifndef CUSTOMFILEICONPROVIDER_H
|
|
|
|
#define CUSTOMFILEICONPROVIDER_H
|
|
|
|
|
|
|
|
#include <QFileIconProvider>
|
|
|
|
|
2022-02-15 00:01:50 +08:00
|
|
|
class GitRepository;
|
2022-02-13 20:08:18 +08:00
|
|
|
class CustomFileIconProvider : public QFileIconProvider
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CustomFileIconProvider();
|
2022-02-14 00:13:00 +08:00
|
|
|
~CustomFileIconProvider();
|
2022-02-15 00:01:50 +08:00
|
|
|
void setRootFolder(const QString& folder);
|
|
|
|
void update();
|
2022-02-14 00:13:00 +08:00
|
|
|
private:
|
2023-08-08 14:41:23 +08:00
|
|
|
#ifdef ENABLE_VCS
|
2022-02-15 00:01:50 +08:00
|
|
|
GitRepository* mVCSRepository;
|
2023-08-08 14:41:23 +08:00
|
|
|
#endif
|
2022-02-13 20:08:18 +08:00
|
|
|
// QFileIconProvider interface
|
|
|
|
public:
|
|
|
|
QIcon icon(IconType type) const override;
|
|
|
|
QIcon icon(const QFileInfo &info) const override;
|
2023-08-08 14:41:23 +08:00
|
|
|
#ifdef ENABLE_VCS
|
2022-02-15 21:39:17 +08:00
|
|
|
GitRepository *VCSRepository() const;
|
2023-08-08 14:41:23 +08:00
|
|
|
#endif
|
2022-02-13 20:08:18 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CUSTOMFILEICONPROVIDER_H
|