2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2012-01-01 15:29:55 +01:00
|
|
|
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-03-02 16:57:41 +01:00
|
|
|
#ifndef SIDEBAR_H
|
|
|
|
#define SIDEBAR_H
|
|
|
|
|
2011-09-11 19:15:06 +02:00
|
|
|
#include <QWidget>
|
2012-04-01 16:36:38 +02:00
|
|
|
#include <QHash>
|
2012-12-20 14:45:35 +01:00
|
|
|
#include <QPointer>
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
#include "qz_namespace.h"
|
|
|
|
|
|
|
|
class QVBoxLayout;
|
2012-04-01 16:36:38 +02:00
|
|
|
class QMenu;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-04-15 20:45:22 +02:00
|
|
|
class DockTitleBarWidget;
|
2012-04-01 16:36:38 +02:00
|
|
|
class SideBarInterface;
|
|
|
|
class SideBarManager;
|
2011-10-17 09:59:09 +02:00
|
|
|
class QupZilla;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
class QT_QUPZILLA_EXPORT SideBar : public QWidget
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-04-01 16:36:38 +02:00
|
|
|
explicit SideBar(SideBarManager* manager, QupZilla* mainClass);
|
2011-09-11 19:15:06 +02:00
|
|
|
|
2011-04-15 20:45:22 +02:00
|
|
|
void showBookmarks();
|
|
|
|
void showHistory();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-04-01 16:36:38 +02:00
|
|
|
void setTitle(const QString &title);
|
|
|
|
void setWidget(QWidget* widget);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
public slots:
|
2011-04-28 18:31:48 +02:00
|
|
|
void close();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-04-15 20:45:22 +02:00
|
|
|
private:
|
2011-10-17 09:59:09 +02:00
|
|
|
QupZilla* p_QupZilla;
|
2011-09-11 19:15:06 +02:00
|
|
|
QVBoxLayout* m_layout;
|
2011-04-15 20:45:22 +02:00
|
|
|
DockTitleBarWidget* m_titleBar;
|
2012-04-01 16:36:38 +02:00
|
|
|
SideBarManager* m_manager;
|
|
|
|
};
|
|
|
|
|
|
|
|
class QT_QUPZILLA_EXPORT SideBarManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit SideBarManager(QupZilla* parent);
|
|
|
|
|
|
|
|
void setSideBarMenu(QMenu* menu);
|
|
|
|
void refreshMenu();
|
|
|
|
|
2012-04-30 16:33:14 +02:00
|
|
|
void showSideBar(const QString &id, bool toggle = true);
|
2012-04-01 16:36:38 +02:00
|
|
|
void sideBarRemoved(const QString &id);
|
|
|
|
void closeSideBar();
|
|
|
|
|
2012-12-20 14:45:35 +01:00
|
|
|
static QHash<QString, QPointer<SideBarInterface> > s_sidebars;
|
2012-04-01 16:36:38 +02:00
|
|
|
static void addSidebar(const QString &id, SideBarInterface* interface);
|
|
|
|
static void removeSidebar(const QString &id);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotShowSideBar();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateActions();
|
|
|
|
|
|
|
|
QupZilla* p_QupZilla;
|
2012-12-20 14:45:35 +01:00
|
|
|
QPointer<SideBar> m_sideBar;
|
2012-04-01 16:36:38 +02:00
|
|
|
QMenu* m_menu;
|
|
|
|
|
|
|
|
QString m_activeBar;
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SIDEBAR_H
|