Example #1
0
	SearchActivity::SearchActivity(SearchPlugin* sp,QWidget* parent)
		: Activity(i18nc("plugin name","Search"),"edit-find",10,parent),sp(sp)
	{
		setXMLGUIFile("ktsearchpluginui.rc");
		setupActions();
		toolbar = new SearchToolBar(part()->actionCollection(),sp->getSearchEngineList(),this);
		connect(toolbar,SIGNAL(search( const QString&, int, bool )),
				sp,SLOT(search( const QString&, int, bool )));
		
		QVBoxLayout* layout = new QVBoxLayout(this);
		layout->setSpacing(0);
		layout->setMargin(0);
		tabs = new KTabWidget(this);
		tabs->setMovable(true);
		layout->addWidget(tabs);
		connect(tabs,SIGNAL(currentChanged(int)),this,SLOT(currentTabChanged(int)));
		
		QToolButton* lc = new QToolButton(tabs);
		tabs->setCornerWidget(lc,Qt::TopLeftCorner);
		QToolButton* rc = new QToolButton(tabs);
		tabs->setCornerWidget(rc,Qt::TopRightCorner);
		lc->setIcon(KIcon("tab-new"));
		connect(lc,SIGNAL(clicked()),this,SLOT(openTab()));
		rc->setIcon(KIcon("tab-close"));
		connect(rc,SIGNAL(clicked()),this,SLOT(closeTab()));
	}
Example #2
0
    TorrentActivity::TorrentActivity(Core* core, GUI* gui, QWidget* parent)
        : TorrentActivityInterface(i18n("Torrents"), QStringLiteral("ktorrent"), parent),
          core(core),
          gui(gui)
    {
        setXMLGUIFile(QStringLiteral("kttorrentactivityui.rc"));
        QWidget* view_part = new QWidget(this);
        view = new View(core, gui, view_part);
        connect(view, &View::currentTorrentChanged, this, &TorrentActivity::currentTorrentChanged);
        search_bar = new TorrentSearchBar(view, view_part);
        search_bar->setHidden(true);

        QVBoxLayout* layout = new QVBoxLayout(this);
        layout->setSpacing(0);
        layout->setMargin(0);
        vsplit = new QSplitter(Qt::Vertical, this);
        layout->addWidget(vsplit);
        hsplit = new QSplitter(Qt::Horizontal, vsplit);

        group_switcher = new GroupSwitcher(view, core->getGroupManager(), this);
        connect(core->getQueueManager(), SIGNAL(queueOrdered()), this, SLOT(queueOrdered()));

        QVBoxLayout* vlayout = new QVBoxLayout(view_part);
        vlayout->setSpacing(0);
        vlayout->setMargin(0);
        vlayout->addWidget(group_switcher);
        vlayout->addWidget(search_bar);
        vlayout->addWidget(view);

        group_view = new GroupView(core->getGroupManager(), view, core, gui, hsplit);
        group_view->setupActions(part()->actionCollection());
        connect(group_view, &GroupView::currentGroupChanged, group_switcher, &GroupSwitcher::currentGroupChanged);
        connect(group_view, &GroupView::openTab, group_switcher, &GroupSwitcher::addTab);

        setupActions();

        hsplit->addWidget(group_view);
        hsplit->addWidget(view_part);
        hsplit->setStretchFactor(0, 1);
        hsplit->setStretchFactor(1, 3);
        vsplit->addWidget(hsplit);
        tool_views = new TabBarWidget(vsplit, this);
        vsplit->setStretchFactor(0, 3);
        vsplit->setStretchFactor(1, 1);
        layout->addWidget(tool_views);

        qm = new QueueManagerWidget(core->getQueueManager(), this);
        connect(core, &Core::torrentAdded, qm, &QueueManagerWidget::onTorrentAdded);
        connect(core, &Core::torrentRemoved, qm, &QueueManagerWidget::onTorrentRemoved);
        tool_views->addTab(qm, i18n("Queue Manager"), QStringLiteral("kt-queue-manager"), i18n("Widget to manage the torrent queue"));

        magnet_view = new MagnetView(core->getMagnetManager(), this);
        tool_views->addTab(magnet_view, i18n("Magnet Downloader"), QStringLiteral("kt-magnet"),
                           i18n("Displays the currently downloading magnet links"));

        QueueManager* qman = core->getQueueManager();
        connect(qman, &QueueManager::suspendStateChanged, this, &TorrentActivity::onSuspendedStateChanged);

        queue_suspend_action->setChecked(core->getSuspendedState());
    }