File indexing completed on 2024-05-19 04:59:20
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #include "testplugin_sidebar.h" 0019 0020 #include <QAction> 0021 #include <QLabel> 0022 #include <QPushButton> 0023 #include <QVBoxLayout> 0024 0025 TestPlugin_Sidebar::TestPlugin_Sidebar(QObject* parent) 0026 : SideBarInterface(parent) 0027 { 0028 } 0029 0030 QString TestPlugin_Sidebar::title() const 0031 { 0032 return tr("Testing Sidebar"); 0033 } 0034 0035 QAction* TestPlugin_Sidebar::createMenuAction() 0036 { 0037 // The action must be parented to some object from plugin, otherwise 0038 // there may be a crash when unloading the plugin. 0039 0040 auto* act = new QAction(tr("Testing Sidebar"), this); 0041 act->setCheckable(true); 0042 0043 return act; 0044 } 0045 0046 QWidget* TestPlugin_Sidebar::createSideBarWidget(BrowserWindow* mainWindow) 0047 { 0048 Q_UNUSED(mainWindow) 0049 0050 auto* w = new QWidget; 0051 auto* b = new QPushButton(QSL("Example Plugin v0.0.1")); 0052 auto* label = new QLabel(); 0053 label->setPixmap(QPixmap(QSL(":icons/other/about.svg"))); 0054 0055 auto* l = new QVBoxLayout(w); 0056 l->addWidget(label); 0057 l->addWidget(b); 0058 w->setLayout(l); 0059 0060 return w; 0061 }