File indexing completed on 2024-12-08 04:34:36
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #pragma once 0007 #include "libruqolawidgets_export.h" 0008 #include <QList> 0009 #include <QObject> 0010 #include <QPointer> 0011 class SwitchChannelTreeView; 0012 class QAction; 0013 class RocketChatAccount; 0014 class LIBRUQOLAWIDGETS_EXPORT SwitchChannelTreeViewManager : public QObject 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit SwitchChannelTreeViewManager(QObject *parent = nullptr); 0019 ~SwitchChannelTreeViewManager() override; 0020 0021 void addActions(const QList<QAction *> &lst); 0022 0023 [[nodiscard]] QWidget *parentWidget() const; 0024 void setParentWidget(QWidget *newParentWidget); 0025 0026 void selectForward(); 0027 void selectBackward(); 0028 void updateViewGeometry(); 0029 0030 [[nodiscard]] SwitchChannelTreeView *switchChannelTreeView() const; 0031 0032 [[nodiscard]] RocketChatAccount *currentRocketChatAccount() const; 0033 void setCurrentRocketChatAccount(RocketChatAccount *newCurrentRocketChatAccount); 0034 0035 Q_SIGNALS: 0036 void switchToChannel(const QString &identifier); 0037 0038 private: 0039 LIBRUQOLAWIDGETS_NO_EXPORT void activateChannel(const QModelIndex &index); 0040 LIBRUQOLAWIDGETS_NO_EXPORT void switchToCollectionClicked(const QModelIndex &index); 0041 LIBRUQOLAWIDGETS_NO_EXPORT void selectChannel(const int from, const int to); 0042 QWidget *mParentWidget = nullptr; 0043 SwitchChannelTreeView *const mSwitcherChannelTreeView; 0044 QPointer<RocketChatAccount> mCurrentRocketChatAccount; 0045 };