1 /************************************************************************** 2 * Otter Browser: Web browser controlled by the user, not vice-versa. 3 * Copyright (C) 2014 - 2015 Piotr Wójcik <chocimier@tlen.pl> 4 * Copyright (C) 2015 - 2018 Michal Dutkiewicz aka Emdek <michal@emdek.pl> 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 * 19 **************************************************************************/ 20 21 #ifndef OTTER_SIDEBARWIDGET_H 22 #define OTTER_SIDEBARWIDGET_H 23 24 #include <QtWidgets/QToolButton> 25 26 namespace Otter 27 { 28 29 namespace Ui 30 { 31 class SidebarWidget; 32 } 33 34 class ContentsWidget; 35 class ResizerWidget; 36 class ToolBarWidget; 37 38 class SidebarWidget final : public QWidget 39 { 40 Q_OBJECT 41 42 public: 43 explicit SidebarWidget(ToolBarWidget *parent); 44 ~SidebarWidget(); 45 46 void reload(); 47 static QString getPanelTitle(const QString &identifier); 48 static QUrl getPanelUrl(const QString &identifier); 49 static QIcon getPanelIcon(const QString &identifier); 50 QSize sizeHint() const override; 51 52 protected: 53 void changeEvent(QEvent *event) override; 54 void selectPanel(const QString &identifier); 55 56 protected slots: 57 void addWebPanel(); 58 void choosePanel(bool isChecked); 59 void saveSize(); 60 void updateLayout(); 61 void updatePanels(); 62 63 private: 64 ToolBarWidget *m_toolBarWidget; 65 ResizerWidget *m_resizerWidget; 66 QString m_currentPanel; 67 QHash<QString, QToolButton*> m_buttons; 68 QHash<QString, ContentsWidget*> m_panels; 69 Ui::SidebarWidget *m_ui; 70 }; 71 72 } 73 74 #endif 75