From 3259abef0963b3fe4638806ae9b8241e964c32a5 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sun, 26 May 2013 15:46:21 +0200 Subject: [PATCH] Added new plugin: StatusBar Icons. This plugins add extra icons into statusbar with various functionality. Currently, only Images icon is present, which enable changing image load settings per-site and globally. --- CHANGELOG | 2 + src/lib/app/qupzilla.cpp | 8 +- src/lib/webview/tabwidget.h | 6 +- .../translations/empty.ts | 2 +- src/plugins/StatusBarIcons/StatusBarIcons.pro | 15 +++ src/plugins/StatusBarIcons/data/icon.png | Bin 0 -> 2310 bytes src/plugins/StatusBarIcons/data/images.png | Bin 0 -> 659 bytes .../StatusBarIcons/sbi_iconsmanager.cpp | 99 ++++++++++++++ src/plugins/StatusBarIcons/sbi_iconsmanager.h | 52 +++++++ src/plugins/StatusBarIcons/sbi_imagesicon.cpp | 127 ++++++++++++++++++ src/plugins/StatusBarIcons/sbi_imagesicon.h | 53 ++++++++ src/plugins/StatusBarIcons/statusbaricons.qrc | 6 + .../StatusBarIcons/statusbariconsplugin.cpp | 84 ++++++++++++ .../StatusBarIcons/statusbariconsplugin.h | 49 +++++++ .../StatusBarIcons/translations/empty.ts | 37 +++++ src/plugins/TestPlugin/translations/empty.ts | 10 +- 16 files changed, 537 insertions(+), 13 deletions(-) create mode 100644 src/plugins/StatusBarIcons/StatusBarIcons.pro create mode 100644 src/plugins/StatusBarIcons/data/icon.png create mode 100644 src/plugins/StatusBarIcons/data/images.png create mode 100644 src/plugins/StatusBarIcons/sbi_iconsmanager.cpp create mode 100644 src/plugins/StatusBarIcons/sbi_iconsmanager.h create mode 100644 src/plugins/StatusBarIcons/sbi_imagesicon.cpp create mode 100644 src/plugins/StatusBarIcons/sbi_imagesicon.h create mode 100644 src/plugins/StatusBarIcons/statusbaricons.qrc create mode 100644 src/plugins/StatusBarIcons/statusbariconsplugin.cpp create mode 100644 src/plugins/StatusBarIcons/statusbariconsplugin.h create mode 100644 src/plugins/StatusBarIcons/translations/empty.ts diff --git a/CHANGELOG b/CHANGELOG index 9191eca60..bcf52939c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ Version 1.5.0 * added possibility to remove EasyList from AdBlock * added inline domain completion to urlbar * added KWallet password backend plugin + * added Gnome-Keyring password backend plugin + * added StatusBar Icons plugin that adds extra icons to statusbar * proxy exceptions now supports wildcards (*, ?) * cancel upload when trying to upload non-readable files * GreaseMonkey: added support for GM_Settings diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 8e5c856e9..fb2e119a6 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -351,10 +351,10 @@ void QupZilla::setupUi() m_ipLabel->setObjectName("statusbar-ip-label"); m_ipLabel->setToolTip(tr("IP Address of current page")); - statusBar()->insertPermanentWidget(0, m_progressBar); - statusBar()->insertPermanentWidget(1, m_ipLabel); - statusBar()->insertPermanentWidget(2, m_privateBrowsing); - statusBar()->insertPermanentWidget(3, m_adblockIcon); + statusBar()->addPermanentWidget(m_progressBar); + statusBar()->addPermanentWidget(m_ipLabel); + statusBar()->addPermanentWidget(m_privateBrowsing); + statusBar()->addPermanentWidget(m_adblockIcon); // Workaround for Oxygen tooltips not having transparent background QPalette pal = QToolTip::palette(); diff --git a/src/lib/webview/tabwidget.h b/src/lib/webview/tabwidget.h index 1868b767f..8df8d75a0 100644 --- a/src/lib/webview/tabwidget.h +++ b/src/lib/webview/tabwidget.h @@ -85,6 +85,9 @@ public: void showNavigationBar(QWidget* bar); + WebTab* weTab(); + WebTab* weTab(int index); + TabBar* getTabBar() const; ClosedTabsManager* closedTabsManager() const; QList allTabs(bool withPinned = true); @@ -138,9 +141,6 @@ private: void resizeEvent(QResizeEvent* e); - WebTab* weTab(); - WebTab* weTab(int index); - bool m_hideTabBarWithOneTab; bool m_dontQuitWithOneTab; bool m_closedInsteadOpened; diff --git a/src/plugins/GnomeKeyringPasswords/translations/empty.ts b/src/plugins/GnomeKeyringPasswords/translations/empty.ts index 39ac73c00..77342e627 100644 --- a/src/plugins/GnomeKeyringPasswords/translations/empty.ts +++ b/src/plugins/GnomeKeyringPasswords/translations/empty.ts @@ -4,7 +4,7 @@ GnomeKeyringPlugin - + Gnome Keyring diff --git a/src/plugins/StatusBarIcons/StatusBarIcons.pro b/src/plugins/StatusBarIcons/StatusBarIcons.pro new file mode 100644 index 000000000..b9a816424 --- /dev/null +++ b/src/plugins/StatusBarIcons/StatusBarIcons.pro @@ -0,0 +1,15 @@ +include(../../defines.pri) + +TARGET = $$qtLibraryTarget(StatusBarIcons) + +SOURCES += statusbariconsplugin.cpp \ + sbi_iconsmanager.cpp \ + sbi_imagesicon.cpp + +HEADERS += statusbariconsplugin.h \ + sbi_iconsmanager.h \ + sbi_imagesicon.h + +RESOURCES += statusbaricons.qrc + +include(../../plugins.pri) diff --git a/src/plugins/StatusBarIcons/data/icon.png b/src/plugins/StatusBarIcons/data/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..32d838532f3fdf394e49b820dcf22e8ccf575e11 GIT binary patch literal 2310 zcmV+h3HkPkP)3#375?7yzCACgvyza6X@H>#ML-~#(I7;bDuYn}w4xHU>K|Z69chG+DpVDu_D3cD zwCayhX_07!x(S#RG_-|MmJ(%fQx_r{r^ILq+ zch33lIrj=!8QPJNk@pNnr=q!(pW zl$l^P8(^_mKoE(5g$!Egn`&YNEs-OGkZd-HL{=#jAc!J_VhA>E+LYbCeftL+H*P$; z5&?}U2ySv2(YYvYJqbhSa>HV` z0(lP#vznd~%w{tJgMQSSYhjZl#NtuttM#zBt?Ii(A|U`UE+b$t7|_(zgt4(P9Zl$r zL?S2%BHGs4(C9Y8O`#Xa5a*x4?^B5s!V|MFms#N~cXA|DPhFNWNCrD>8XL@#1rdJ; z3#J8-V@RjdDHg0sps}$LWo2cemO!B~A3JuerM$en!|rfw=RB?_W9%EHq-0zj&!0cX z$n8N){dNj(uKfbWW=4=&ox+9#Em*sDEu7UZEKDszlI+kzBr*=nC!)woSx!-$b* zx_dERJEo>)Rn01ljE$mPUk(AH`d?YegF&m|p9GE{Ki;}y$BwJnT+YS@GNg7|^Q>Mr z%z0&@vEdh2=ULG!QGuLzhNXyP{XrWy{c7H3-hkBAA=OtTBj+iVD@4csw3c33PXNPin|pp4{*A z;pDG8@Yb-@?&yx5-))@gMtGXw|OC_Wr&gprJx{~p2lSP6jrZZ z4Te-H!Izsr&Ynf%nnp;HR1z;opdg+02D2N80Gi@X`$7ulTntOQ$q#RMV@fPn|k- zmP+uhQla5x#JMZ3kk|2=|I61UX_%OpU}16xCW8e=tpgf-4jQElCcOl`&ca^v z{E%!C6Xq4MgaCs*%XD^j{++y81i%{-{NeFW5v#wCH+NTH{cbmWuB*5+)XDFbEIEda zCJ#=oK`Jv30agft4s-DsW+xlDn=%0|THFO$2Wlr=LV%Q6pceZ)7z~au%L(5Ermgqj zsM7-G1r$tixIVANgwVwsktN>qpq38*Xcc~cQHO{94{-0v04{dA5s%t=6Uqc$lw`6K zTt;Accvt}tCBZy`+V4X!N?MqVW@tp6IxHp&bXI}aF&kYnY&IL-fByrR^;>b}vV_0> z#f6&6Z8&h?fNEH$(Y>3{C1DGaKQTm-`$4L1FT4nf`M>7h)bmGK`AMDz- z>!YHVEFAWb^9TyxA{DI}n#|kP)zwF(oWnUr?^&41rSKO91_l(`Z(t>8@d~&- zU$}7LDjl7^VYOOaG=WTc4Dor6LfZfI>C-+kFiImpMneGNbf4jBO7%pc11tV3G&eU3 zl>c(t)$Bid^yrUw?%a8d?!QKnX{Bo&UF}3p-`d(L^4|adg3X&Zi)6^kL})naw~@~e gEiEmo(*KwE2f#WYL%FoDP5=M^07*qoM6N<$f`e#IaR2}S literal 0 HcmV?d00001 diff --git a/src/plugins/StatusBarIcons/data/images.png b/src/plugins/StatusBarIcons/data/images.png new file mode 100644 index 0000000000000000000000000000000000000000..c7553602ee19a78efda8e9bbf968e21c19415ef2 GIT binary patch literal 659 zcmV;E0&M+>P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L02{9W02{9XUK)`c00007bV*G`2ipM! z0R<`?RywJ}e7^VI7S0T$LQy?%;BYzT zInTK~2mTQv6bgkmHa2WPS3~_lt^pZ~#g+j2^|=NXvutj*Q%W^rH`%y* zCut0S#g>N|-FK0)6#?x~$QK#A(+?nw`YtVN5H%21850Aq<>k3o(wS%?cr?iI{4BT( zgb)};y^VVI&K+UN8)4e<;W6C=rH6xGx_Rm9V^O5=H#dM%2(3V?-2}dT2if;6*z*zm z9xp!WVqmS8w)^`L9VeJHW1uBUDYSBS6GZyX)3zumi6W!6LDIj5TrY7b7-b>V&9^*A zr;MzWD3^+q3ON8>CvaL1P>dg;GrYj{`5E5&r||W;SUH(tI_)8oo+G=uj3Ku;)zixG z@PjwNvRNb0%E3H)g^8#Om3&Hb*Cn2GwX?ErvHCg5#G?z_gUUrlMjoba-@SJlD408) z)!yL3-IGAtXZXIE$IylP&a0UW&&J2IH*VgF11rD$!L|y?kJpb08e3Ex1)};cCDN(z zYHF%@b#QP1_)zPqE07A50(X3jj6aN!4niuV)EHFsr +* +* 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 . +* ============================================================ */ +#include "sbi_iconsmanager.h" +#include "sbi_imagesicon.h" +#include "qupzilla.h" + +#include +#include +#include + +SBI_IconsManager::SBI_IconsManager(const QString &settingsPath, QObject* parent) + : QObject(parent) + , m_settingsPath(settingsPath) + , m_showImagesIcon(false) + , m_showJavaScriptIcon(false) + , m_showNetworkIcon(false) +{ + loadSettings(); +} + +void SBI_IconsManager::loadSettings() +{ + QSettings settings(m_settingsPath + "extensions.ini", QSettings::IniFormat); + settings.beginGroup("StatusBarIcons"); + m_showImagesIcon = settings.value("showImagesIcon", true).toBool(); + m_showJavaScriptIcon = settings.value("showJavaScriptIcon", true).toBool(); + m_showNetworkIcon = settings.value("showNetworkIcon", true).toBool(); + settings.endGroup(); +} + +void SBI_IconsManager::reloadIcons() +{ + QHashIterator it(m_windows); + + while (it.hasNext()) { + it.next(); + mainWindowDeleted(it.key()); + mainWindowCreated(it.key()); + } +} + +void SBI_IconsManager::destroyIcons() +{ + QHashIterator it(m_windows); + + while (it.hasNext()) { + it.next(); + mainWindowDeleted(it.key()); + } +} + +void SBI_IconsManager::mainWindowCreated(QupZilla* window) +{ + typedef QWidget SBI_JavaScriptIcon; + typedef QWidget SBI_NetworkIcon; + + if (m_showImagesIcon) { + SBI_ImagesIcon* w = new SBI_ImagesIcon(window, m_settingsPath); + window->statusBar()->addPermanentWidget(w); + m_windows[window].append(w); + } + + if (m_showJavaScriptIcon) { + SBI_JavaScriptIcon* w = new SBI_JavaScriptIcon; + window->statusBar()->addPermanentWidget(w); + m_windows[window].append(w); + } + + if (m_showNetworkIcon) { + SBI_NetworkIcon* w = new SBI_NetworkIcon; + window->statusBar()->addPermanentWidget(w); + m_windows[window].append(w); + } +} + +void SBI_IconsManager::mainWindowDeleted(QupZilla* window) +{ + foreach (QWidget* w, m_windows[window]) { + window->statusBar()->removeWidget(w); + delete w; + } + + m_windows[window].clear(); +} diff --git a/src/plugins/StatusBarIcons/sbi_iconsmanager.h b/src/plugins/StatusBarIcons/sbi_iconsmanager.h new file mode 100644 index 000000000..364b0d989 --- /dev/null +++ b/src/plugins/StatusBarIcons/sbi_iconsmanager.h @@ -0,0 +1,52 @@ +/* ============================================================ +* StatusBarIcons - Extra icons in statusbar for QupZilla +* Copyright (C) 2013 David Rosca +* +* 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 . +* ============================================================ */ +#ifndef SBI_ICONSMANAGER_H +#define SBI_ICONSMANAGER_H + +#include +#include + +class QupZilla; + +class SBI_IconsManager : public QObject +{ + Q_OBJECT +public: + explicit SBI_IconsManager(const QString &settingsPath, QObject* parent = 0); + + void loadSettings(); + + void reloadIcons(); + void destroyIcons(); + +signals: + +public slots: + void mainWindowCreated(QupZilla* window); + void mainWindowDeleted(QupZilla* window); + +private: + QString m_settingsPath; + bool m_showImagesIcon; + bool m_showJavaScriptIcon; + bool m_showNetworkIcon; + + QHash m_windows; +}; + +#endif // SBI_ICONSMANAGER_H diff --git a/src/plugins/StatusBarIcons/sbi_imagesicon.cpp b/src/plugins/StatusBarIcons/sbi_imagesicon.cpp new file mode 100644 index 000000000..6b5c23a34 --- /dev/null +++ b/src/plugins/StatusBarIcons/sbi_imagesicon.cpp @@ -0,0 +1,127 @@ +/* ============================================================ +* StatusBarIcons - Extra icons in statusbar for QupZilla +* Copyright (C) 2013 David Rosca +* +* 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 . +* ============================================================ */ +#include "sbi_imagesicon.h" +#include "mainapplication.h" +#include "qupzilla.h" +#include "tabwidget.h" +#include "tabbedwebview.h" +#include "webpage.h" + +#include +#include +#include +#include + +SBI_ImagesIcon::SBI_ImagesIcon(QupZilla* window, const QString &settingsPath) + : ClickableLabel(window) + , p_QupZilla(window) + , m_settingsFile(settingsPath + "extensions.ini") +{ + setCursor(Qt::PointingHandCursor); + setToolTip(tr("Modify images loading settings per-site and globally")); + + m_icon = QIcon::fromTheme("image-x-genericsss", QIcon(":sbi/data/images.png")); + setPixmap(m_icon.pixmap(16)); + + QSettings settings(m_settingsFile, QSettings::IniFormat); + settings.beginGroup("StatusBarIcons_Images"); + m_loadingImages = settings.value("LoadImages", true).toBool(); + settings.endGroup(); + + mApp->webSettings()->setAttribute(QWebSettings::AutoLoadImages, m_loadingImages); + + updateIcon(); + + connect(p_QupZilla->tabWidget(), SIGNAL(currentChanged(int)), this, SLOT(updateIcon())); + connect(this, SIGNAL(clicked(QPoint)), this, SLOT(showMenu(QPoint))); +} + +void SBI_ImagesIcon::showMenu(const QPoint &point) +{ + QFont boldFont = font(); + boldFont.setBold(true); + + QMenu menu; + + menu.addAction(m_icon, tr("Current page settings"))->setFont(boldFont); + + if (currentPageSettings()->testAttribute(QWebSettings::AutoLoadImages)) { + menu.addAction(tr("Disable loading images (temporarily)"), this, SLOT(toggleLoadingImages())); + } + else { + menu.addAction(tr("Enable loading images (temporarily)"), this, SLOT(toggleLoadingImages())); + } + + menu.addSeparator(); + menu.addAction(m_icon, tr("Global settings"))->setFont(boldFont); + + QAction* act = menu.addAction(tr("Automatically load images")); + act->setCheckable(true); + act->setChecked(m_loadingImages); + connect(act, SIGNAL(toggled(bool)), this, SLOT(setGlobalLoadingImages(bool))); + + menu.exec(point); +} + +void SBI_ImagesIcon::toggleLoadingImages() +{ + bool current = currentPageSettings()->testAttribute(QWebSettings::AutoLoadImages); + currentPageSettings()->setAttribute(QWebSettings::AutoLoadImages, !current); + + // We should reload page on disabling images + if (current) { + p_QupZilla->tabWidget()->weTab()->reload(); + } + + updateIcon(); +} + +void SBI_ImagesIcon::setGlobalLoadingImages(bool enable) +{ + // Save it permanently + QSettings settings(m_settingsFile, QSettings::IniFormat); + settings.beginGroup("StatusBarIcons_Images"); + settings.setValue("LoadImages", enable); + settings.endGroup(); + + // Switch it in websettings + mApp->webSettings()->setAttribute(QWebSettings::AutoLoadImages, enable); + updateIcon(); + + // We should reload page on disabling images + if (!enable) { + p_QupZilla->tabWidget()->weTab()->reload(); + } +} + +QWebSettings* SBI_ImagesIcon::currentPageSettings() +{ + return p_QupZilla->tabWidget()->weTab()->view()->page()->settings(); +} + +void SBI_ImagesIcon::updateIcon() +{ + if (currentPageSettings()->testAttribute(QWebSettings::AutoLoadImages)) { + setGraphicsEffect(0); + } + else { + QGraphicsColorizeEffect* effect = new QGraphicsColorizeEffect(this); + effect->setColor(Qt::gray); + setGraphicsEffect(effect); + } +} diff --git a/src/plugins/StatusBarIcons/sbi_imagesicon.h b/src/plugins/StatusBarIcons/sbi_imagesicon.h new file mode 100644 index 000000000..24dd6be0f --- /dev/null +++ b/src/plugins/StatusBarIcons/sbi_imagesicon.h @@ -0,0 +1,53 @@ +/* ============================================================ +* StatusBarIcons - Extra icons in statusbar for QupZilla +* Copyright (C) 2013 David Rosca +* +* 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 . +* ============================================================ */ +#ifndef SBI_IMAGESICON_H +#define SBI_IMAGESICON_H + +#include + +#include "clickablelabel.h" + +class QWebSettings; + +class QupZilla; + +class SBI_ImagesIcon : public ClickableLabel +{ + Q_OBJECT + +public: + explicit SBI_ImagesIcon(QupZilla* window, const QString &settingsPath); + +private slots: + void showMenu(const QPoint &point); + void updateIcon(); + + void toggleLoadingImages(); + void setGlobalLoadingImages(bool enable); + +private: + QWebSettings* currentPageSettings(); + + QupZilla* p_QupZilla; + QString m_settingsFile; + + QIcon m_icon; + bool m_loadingImages; +}; + +#endif // SBI_IMAGESICON_H diff --git a/src/plugins/StatusBarIcons/statusbaricons.qrc b/src/plugins/StatusBarIcons/statusbaricons.qrc new file mode 100644 index 000000000..1ba7940a3 --- /dev/null +++ b/src/plugins/StatusBarIcons/statusbaricons.qrc @@ -0,0 +1,6 @@ + + + data/icon.png + data/images.png + + diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.cpp b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp new file mode 100644 index 000000000..d7dfcd64a --- /dev/null +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.cpp @@ -0,0 +1,84 @@ +/* ============================================================ +* StatusBarIcons - Extra icons in statusbar for QupZilla +* Copyright (C) 2013 David Rosca +* +* 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 . +* ============================================================ */ +#include "statusbariconsplugin.h" +#include "sbi_iconsmanager.h" +#include "pluginproxy.h" +#include "qupzilla.h" + +#include + +StatusBarIconsPlugin::StatusBarIconsPlugin() + : QObject() + , m_manager(0) +{ +} + +PluginSpec StatusBarIconsPlugin::pluginSpec() +{ + PluginSpec spec; + spec.name = "StatusBar Icons"; + spec.info = "Icons in statusbar providing various actions"; + spec.description = "Adds additional icons to statusbar"; + spec.version = "0.1.0"; + spec.author = "David Rosca "; + spec.icon = QPixmap(":sbi/data/icon.png"); + spec.hasSettings = false; + + return spec; +} + +void StatusBarIconsPlugin::init(InitState state, const QString &settingsPath) +{ + m_manager = new SBI_IconsManager(settingsPath); + + connect(mApp->plugins(), SIGNAL(mainWindowCreated(QupZilla*)), m_manager, SLOT(mainWindowCreated(QupZilla*))); + connect(mApp->plugins(), SIGNAL(mainWindowDeleted(QupZilla*)), m_manager, SLOT(mainWindowDeleted(QupZilla*))); + + // Make sure icons are added also to already created windows + if (state == LateInitState) { + foreach (QupZilla* window, mApp->mainWindows()) { + m_manager->mainWindowCreated(window); + } + } +} + +void StatusBarIconsPlugin::unload() +{ + // Make sure icons are properly removed when unloading plugin (but not when closing app) + if (!mApp->isClosing()) { + foreach (QupZilla* window, mApp->mainWindows()) { + m_manager->mainWindowDeleted(window); + } + + delete m_manager; + } +} + +bool StatusBarIconsPlugin::testPlugin() +{ + return (QupZilla::VERSION == QLatin1String("1.5.0")); +} + +void StatusBarIconsPlugin::showSettings(QWidget* parent) +{ + Q_UNUSED(parent) +} + +#if QT_VERSION < 0x050000 +Q_EXPORT_PLUGIN2(StatusBarIcons, StatusBarIconsPlugin) +#endif diff --git a/src/plugins/StatusBarIcons/statusbariconsplugin.h b/src/plugins/StatusBarIcons/statusbariconsplugin.h new file mode 100644 index 000000000..45deb1b7f --- /dev/null +++ b/src/plugins/StatusBarIcons/statusbariconsplugin.h @@ -0,0 +1,49 @@ +/* ============================================================ +* StatusBarIcons - Extra icons in statusbar for QupZilla +* Copyright (C) 2013 David Rosca +* +* 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 . +* ============================================================ */ +#ifndef STATUSBARICONSPLUGIN_H +#define STATUSBARICONSPLUGIN_H + +#include "plugininterface.h" + +class SBI_IconsManager; + +class StatusBarIconsPlugin : public QObject, public PluginInterface +{ + Q_OBJECT + Q_INTERFACES(PluginInterface) + +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.StatusBarIcons") +#endif + +public: + explicit StatusBarIconsPlugin(); + PluginSpec pluginSpec(); + + void init(InitState state, const QString &settingsPath); + void unload(); + bool testPlugin(); + + void showSettings(QWidget* parent = 0); + +private: + SBI_IconsManager* m_manager; + +}; + +#endif // STATUSBARICONSPLUGIN_H diff --git a/src/plugins/StatusBarIcons/translations/empty.ts b/src/plugins/StatusBarIcons/translations/empty.ts new file mode 100644 index 000000000..6f430b8eb --- /dev/null +++ b/src/plugins/StatusBarIcons/translations/empty.ts @@ -0,0 +1,37 @@ + + + + + SBI_ImagesIcon + + + Modify images loading settings per-site and globally + + + + + Current page settings + + + + + Disable loading images (temporarily) + + + + + Enable loading images (temporarily) + + + + + Global settings + + + + + Automatically load images + + + + diff --git a/src/plugins/TestPlugin/translations/empty.ts b/src/plugins/TestPlugin/translations/empty.ts index 087f269b1..8c29987bf 100644 --- a/src/plugins/TestPlugin/translations/empty.ts +++ b/src/plugins/TestPlugin/translations/empty.ts @@ -4,27 +4,27 @@ TestPlugin - + Close - + Example Plugin Settings - + My first plugin action - + Hello - + First plugin action works :-)