2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2017-01-17 12:33:55 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-05-04 16:19:00 +02:00
|
|
|
#include "utils_global.h"
|
|
|
|
|
|
|
|
|
|
#include "id.h"
|
2022-05-25 12:57:21 +02:00
|
|
|
#include "infobar.h"
|
2023-08-23 17:51:05 +02:00
|
|
|
#include "store.h"
|
2020-06-17 09:14:47 +02:00
|
|
|
|
2017-01-17 12:33:55 +01:00
|
|
|
#include <QHash>
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
|
2022-05-24 13:45:35 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QAction;
|
|
|
|
|
QT_END_NAMESPACE
|
2022-05-24 10:54:44 +02:00
|
|
|
|
2022-05-04 16:19:00 +02:00
|
|
|
namespace Utils {
|
2017-01-17 12:33:55 +01:00
|
|
|
|
2022-05-04 16:19:00 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT MinimizableInfoBars : public QObject
|
2017-01-17 12:33:55 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
using ActionCreator = std::function<QAction *(QWidget *widget)>;
|
|
|
|
|
|
|
|
|
|
public:
|
2022-05-24 10:54:44 +02:00
|
|
|
explicit MinimizableInfoBars(InfoBar &infoBar);
|
2017-01-17 12:33:55 +01:00
|
|
|
|
2023-08-23 17:51:05 +02:00
|
|
|
void setSettingsGroup(const Key &settingsGroup);
|
2022-05-24 10:54:44 +02:00
|
|
|
void setPossibleInfoBarEntries(const QList<InfoBarEntry> &entries);
|
2022-05-04 15:03:52 +02:00
|
|
|
|
2022-05-02 17:11:18 +02:00
|
|
|
void createShowInfoBarActions(const ActionCreator &actionCreator) const;
|
2017-01-17 12:33:55 +01:00
|
|
|
|
2022-05-24 10:54:44 +02:00
|
|
|
void setInfoVisible(const Id &id, bool visible);
|
2017-01-17 12:33:55 +01:00
|
|
|
|
|
|
|
|
private:
|
2022-05-02 17:11:18 +02:00
|
|
|
void createActions();
|
|
|
|
|
|
2023-08-23 17:51:05 +02:00
|
|
|
Key settingsKey(const Id &id) const;
|
2022-05-24 10:54:44 +02:00
|
|
|
bool showInInfoBar(const Id &id) const;
|
|
|
|
|
void setShowInInfoBar(const Id &id, bool show);
|
2022-05-03 11:01:24 +02:00
|
|
|
|
2022-05-24 10:54:44 +02:00
|
|
|
void updateInfo(const Id &id);
|
2017-01-17 12:33:55 +01:00
|
|
|
|
2022-05-24 10:54:44 +02:00
|
|
|
void showInfoBar(const Id &id);
|
2017-01-17 12:33:55 +01:00
|
|
|
|
2022-05-24 10:54:44 +02:00
|
|
|
InfoBar &m_infoBar;
|
2023-08-23 17:51:05 +02:00
|
|
|
Key m_settingsGroup;
|
2022-05-24 10:54:44 +02:00
|
|
|
QHash<Id, QAction *> m_actions;
|
|
|
|
|
QHash<Id, bool> m_isInfoVisible;
|
|
|
|
|
QHash<Id, InfoBarEntry> m_infoEntries;
|
2017-01-17 12:33:55 +01:00
|
|
|
};
|
|
|
|
|
|
2022-05-04 16:19:00 +02:00
|
|
|
} // namespace Utils
|