コード例 #1
0
	GeneralHandler::GeneralHandler (ICoreProxy_ptr proxy)
	: Proxy_ (proxy)
	{
		const QList<ConcreteHandlerBase_ptr> coreHandlers
		{
			std::make_shared<SystemTrayHandler> (),
			std::make_shared<VisualHandler> (),
			std::make_shared<AudioHandler> (),
			std::make_shared<CmdRunHandler> (),
			std::make_shared<WMUrgentHandler> ()
		};

		for (const auto& handler : coreHandlers)
		{
			handler->SetGeneralHandler (this);
			Handlers_ << handler;
		}

		connect (coreHandlers.first ().get (),
				SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)),
				this,
				SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)));

		Cat2IconName_ [AN::CatDownloads] = "folder-downloads";
		Cat2IconName_ [AN::CatIM] = "mail-unread-new";
		Cat2IconName_ [AN::CatOrganizer] = "view-calendar";
		Cat2IconName_ [AN::CatGeneric] = "preferences-desktop-notification-bell";
		Cat2IconName_ [AN::CatPackageManager] = "system-software-update";
		Cat2IconName_ [AN::CatMediaPlayer] = "applications-multimedia";
		Cat2IconName_ [AN::CatTerminal] = "utilities-terminal";
	}
コード例 #2
0
ファイル: pierre.cpp プロジェクト: Kalarel/leechcraft
	void Plugin::fillMenu ()
	{
		auto menu = Proxy_->GetMWProxy ()->GetMainMenu ();

		QMenu *lcMenu = 0;
		QList<QAction*> firstLevelActions;
		Q_FOREACH (auto action, menu->actions ())
			if (action->menu ())
			{
				MenuBar_->addAction (action);
				if (!lcMenu)
					lcMenu = action->menu ();
			}
			else
			{
				if (action->menuRole () == QAction::TextHeuristicRole)
					action->setMenuRole (QAction::ApplicationSpecificRole);
				firstLevelActions << action;
			}

		Q_FOREACH (auto act, firstLevelActions)
			lcMenu->addAction (act);

		if (!lcMenu->actions ().isEmpty ())
			MenuBar_->addMenu (lcMenu);

		const auto& actors = Proxy_->GetPluginsManager ()->
				GetAllCastableRoots<IActionsExporter*> ();
		Q_FOREACH (auto actor, actors)
			connect (actor,
					SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)),
					this,
					SLOT (handleGotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)));
	}
コード例 #3
0
ファイル: liznoo.cpp プロジェクト: Akon32/leechcraft
	void Plugin::handleBatteryInfo (BatteryInfo info)
	{
		if (!Battery2Action_.contains (info.ID_))
		{
			QAction *act = new QAction (tr ("Battery status"), this);
			act->setProperty ("WatchActionIconChange", true);
			act->setProperty ("Liznoo/BatteryID", info.ID_);

			act->setProperty ("Action/Class", GetUniqueID () + "/BatteryAction");
			act->setProperty ("Action/ID", GetUniqueID () + "/" + info.ID_);

			emit gotActions (QList<QAction*> () << act, AEPLCTray);
			Battery2Action_ [info.ID_] = act;

			connect (act,
					SIGNAL (triggered ()),
					this,
					SLOT (handleHistoryTriggered ()));
		}

		UpdateAction (info);
		CheckNotifications (info);

		Battery2LastInfo_ [info.ID_] = info;
	}
コード例 #4
0
ファイル: liznoo.cpp プロジェクト: ForNeVeR/leechcraft
	void Plugin::handleBatteryInfo (BatteryInfo info)
	{
#if QT_VERSION < 0x050000
		const auto& iconName = GetBattIconName (info);
		if (!Battery2Action_.contains (info.ID_))
		{
			QAction *act = new QAction (tr ("Battery status"), this);
			act->setProperty ("WatchActionIconChange", true);
			act->setProperty ("Liznoo/BatteryID", info.ID_);

			act->setProperty ("Action/Class", GetUniqueID () + "/BatteryAction");
			act->setProperty ("Action/ID", GetUniqueID () + "/" + info.ID_);
			act->setProperty ("ActionIcon", iconName);

			emit gotActions ({ act }, ActionsEmbedPlace::LCTray);
			Battery2Action_ [info.ID_] = act;

			connect (act,
					SIGNAL (triggered ()),
					this,
					SLOT (handleHistoryTriggered ()));
		}
		else
			Battery2Action_ [info.ID_]->setProperty ("ActionIcon", iconName);
#endif

		CheckNotifications (info);

		Battery2LastInfo_ [info.ID_] = info;
	}
コード例 #5
0
ファイル: gmailnotifier.cpp プロジェクト: Kalarel/leechcraft
	void GmailNotifier::CheckCreateAction ()
	{
		if (NotifierAction_)
			return;

		NotifierAction_ = new QAction (this);
		emit gotActions ({ NotifierAction_ }, ActionsEmbedPlace::LCTray);
	}
コード例 #6
0
	TrayComponent::TrayComponent (ICoreProxy_ptr proxy, SBView *view, QObject *parent)
	: BaseActionComponent ({ "SB2_TrayActionImage", "TrayComponent.qml", "SB2_trayModel" }, proxy, view, parent)
	{
		const auto& hasActions = Proxy_->GetPluginsManager ()->
				GetAllCastableRoots<IActionsExporter*> ();
		for (QObject *actObj : hasActions)
			connect (actObj,
					SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)),
					this,
					SLOT (handleGotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)));
	}
コード例 #7
0
	void Plugin::fillMenu ()
	{
		if (!UnityDetected_)
			return;

		auto menu = Proxy_->GetRootWindowsManager ()->GetMWProxy (0)->GetMainMenu ();

		QMenu *lcMenu = 0;
		QList<QAction*> firstLevelActions;
		for (auto action : menu->actions ())
			if (action->menu ())
			{
				MenuBar_->addAction (action);
				if (!lcMenu)
					lcMenu = action->menu ();
			}
			else
			{
				if (action->menuRole () == QAction::TextHeuristicRole)
					action->setMenuRole (QAction::ApplicationSpecificRole);
				firstLevelActions << action;
			}

		if (!lcMenu)
		{
			qWarning () << Q_FUNC_INFO
					<< "LeechCraft menu not found";
			return;
		}

		for (auto act : irstLevelActions)
			lcMenu->addAction (act);

		if (!lcMenu->actions ().isEmpty ())
			MenuBar_->addMenu (lcMenu);

		for (auto actor : Proxy_->GetPluginsManager ()->GetAllCastableRoots<IActionsExporter*> ())
			connect (actor,
					SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)),
					this,
					SLOT (handleGotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)));
	}
コード例 #8
0
	void Plugin::checkAction ()
	{
		if (!Backend_)
			return;

		if (TrayView_->HasItems () == static_cast<bool> (ActionDevices_))
			return;

		if (!TrayView_->HasItems ())
		{
			ActionDevices_.reset ();
			return;
		}

		ActionDevices_.reset (new QAction (tr ("Removable devices..."), this));
		ActionDevices_->setProperty ("ActionIcon", "drive-removable-media-usb");

		connect (ActionDevices_.get (),
				SIGNAL (triggered ()),
				this,
				SLOT (showTrayView ()));
		emit gotActions ({ ActionDevices_.get () }, ActionsEmbedPlace::LCTray);
	}