OutputWidget::OutputWidget(QWidget* parent, ToolViewData* tvdata)
    : QWidget( parent ), tabwidget(0), data(tvdata)
{
    setWindowTitle(i18n("Output View"));
    setWindowIcon(tvdata->icon);
    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->setMargin(0);
    if( data->type & KDevelop::IOutputView::MultipleView )
    {
        tabwidget = new KTabWidget(this);
        layout->addWidget( tabwidget );
        m_closeButton = new QToolButton( this );
        connect( m_closeButton, SIGNAL( clicked() ),
                 this, SLOT( closeActiveView() ) );
        m_closeButton->setIcon( KIcon("tab-close") );
        m_closeButton->adjustSize();
        m_closeButton->setToolTip( i18n( "Close the currently active output view") );
        tabwidget->setCornerWidget( m_closeButton, Qt::TopRightCorner );
    } else if ( data->type == KDevelop::IOutputView::HistoryView )
    {
        stackwidget = new QStackedWidget( this );
        layout->addWidget( stackwidget );

        previousAction = new KAction( KIcon( "go-previous" ), i18n("Previous"), this );
        connect(previousAction, SIGNAL(triggered()), this, SLOT(previousOutput()));
        addAction(previousAction);
        nextAction = new KAction( KIcon( "go-next" ), i18n("Next"), this );
        connect(nextAction, SIGNAL(triggered()), this, SLOT(nextOutput()));
        addAction(nextAction);
    }

    activateOnSelect = new KToggleAction( KIcon(), i18n("Select activated Item"), this );
    addAction(activateOnSelect);
    activateOnSelect->setChecked( true );
    focusOnSelect = new KToggleAction( KIcon(), i18n("Focus when selecting Item"), this );
    addAction(focusOnSelect);
    focusOnSelect->setChecked( false );


    connect( data, SIGNAL( outputAdded( int ) ),
             this, SLOT( addOutput( int ) ) );

    connect( this, SIGNAL( outputRemoved( int, int ) ),
             data->plugin, SIGNAL( outputRemoved( int, int ) ) );

    connect( data->plugin, SIGNAL(selectNextItem()), this, SLOT(selectNextItem()) );
    connect( data->plugin, SIGNAL(selectPrevItem()), this, SLOT(selectPrevItem()) );

    foreach( int id, data->outputdata.keys() )
    {
        changeModel( id );
        changeDelegate( id );
    }
    enableActions();
}
Пример #2
0
void TabbedWidget::wheelEvent(QWheelEvent* e)
{
    if (e->delta() < 0)
        selectNextItem();
    else
        selectPreviousItem();
}
Пример #3
0
void InspectTool::mouseDoubleClickEvent(QMouseEvent *event)
{
    m_mousePosition = event->localPos();
    m_pressAndHoldTimer.stop();
    if (event->button() == Qt::LeftButton) {
        selectNextItem();
        m_hoverHighlight->setVisible(false);
    }
}
Пример #4
0
    void Menu::keyPressed(gcn::KeyEvent& keyEvent) {
        std::cout << "Menu::keyPressed" << std::endl;
        hikari::Input::Button button =
            InputHelper::getMappedButtonForKey(keyEvent.getKey());

        if(button == Input::BUTTON_UP) {
            selectPreviousItem();
            keyEvent.consume();
        } else if(button == Input::BUTTON_DOWN) {
            selectNextItem();
            keyEvent.consume();
        } else if(button == Input::BUTTON_START || button == Input::BUTTON_SHOOT) {
            distributeActionEvent();
        }
    }
Пример #5
0
void CGUIDialog::setSelection(const unsigned int sel)
{
	const int steps = sel-mSelection;

	if(steps == 0)
		return;

	if(steps > 0)
	{
		for(int c=0 ; c<steps ; c++)
			selectNextItem();
	}
	else
	{
		for(int c=0 ; c<-steps ; c++)
			selectPrevItem();
	}
}
Пример #6
0
bool CGUIDialog::sendEvent( const std::shared_ptr<CEvent> &command )
{
	if( CommandEvent *ev = dynamic_cast<CommandEvent*>(command.get()) )
	{
		// Send all the other events the active control element
		int i=0;
		for( auto &it : mControlList )
		{
		    //if( (i == mSelection) && it->getHovered() )
		    if( i == mSelection )
		    {
			if( !it->getHovered() )
			{
			    it->setHovered( (i == mSelection) );
			}
			else
			{
			    if( it->sendEvent(ev->mCommand) )
				return true;
			}
		    }
		    else
		    {
			it->setHovered( false );
		    }
		    i++;
		}

		if(ev->mCommand == IC_DOWN)
		{
			selectNextItem();
			return true;
		}
		else if(ev->mCommand == IC_UP)
		{
			selectPrevItem();
			return true;
		}
	}

	return false;
}
Thread* GuidedThreadScheduler::selectCurrentItem() {
	return selectNextItem();
}
Thread* PreemptiveThreadScheduler::selectCurrentItem() {
	return selectNextItem();
}
Thread* FIFSThreadScheduler::selectCurrentItem() {
	return selectNextItem();
}
Пример #10
0
void InspectTool::touchEvent(QTouchEvent *event)
{
    QList<QTouchEvent::TouchPoint> touchPoints = event->touchPoints();

    switch (event->type()) {
    case QEvent::TouchBegin:
        if (touchPoints.count() == 1 && (event->touchPointStates() & Qt::TouchPointPressed)) {
            if (!m_pressAndHoldTimer.isActive())
                m_pressAndHoldTimer.start();
            m_mousePosition = touchPoints.first().pos();
            initializeDrag(touchPoints.first().pos());
            m_tapEvent = true;
        } else {
            m_tapEvent = false;
        }
        break;
    case QEvent::TouchUpdate: {
        if (touchPoints.count() > 1)
            m_tapEvent = false;
        if ((touchPoints.count() == 1)
                && (event->touchPointStates() & Qt::TouchPointMoved)) {
            m_mousePosition = touchPoints.first().pos();
            moveItem(true);
        } else if ((touchPoints.count() == 2)
                   && (!(event->touchPointStates() & Qt::TouchPointReleased))) {
            // determine scale factor
            const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
            const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();

            qreal touchScaleFactor =
                    QLineF(touchPoint0.pos(), touchPoint1.pos()).length()
                    / QLineF(touchPoint0.lastPos(), touchPoint1.lastPos()).length();

            QPointF oldcenter = (touchPoint0.lastPos() + touchPoint1.lastPos()) / 2;
            QPointF newcenter = (touchPoint0.pos() + touchPoint1.pos()) / 2;

            m_pinchStarted = true;
            scaleView(touchScaleFactor, newcenter, oldcenter);
        }
        break;
    }
    case QEvent::TouchEnd: {
        m_pressAndHoldTimer.stop();
        if (m_pinchStarted) {
            m_pinchStarted = false;
        }
        if (touchPoints.count() == 1 && !m_dragStarted &&
                !m_didPressAndHold && m_tapEvent) {
            m_tapEvent = false;
            bool doubleTap = event->timestamp() - m_touchTimestamp
                    < static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
            if (doubleTap) {
                m_nameDisplayTimer.stop();
                selectNextItem();
            }
            else {
                selectItem();
            }
            m_touchTimestamp = event->timestamp();
        }
        m_didPressAndHold = false;
        break;
    }
    default:
        break;
    }
}
Пример #11
0
void RazorAppSwitcher::AppSwitcher::handleApps()
{
    qDebug() << "RazorAppSwitcher::AppSwitcher::handleApps()";

    if (m_layout->count())
    {
        QLayoutItem * item;
        while ((item = m_layout->takeAt(0)) != 0)
        {
            item->widget()->hide();
            delete item;
        }
    }
    m_list.clear();

    QList<Window> l = xfitMan().getClientList();
    QList<Window> merge;
    // setup already used windows
    foreach (Window w, m_orderedWindows)
    {
        if (l.contains(w))
        {
            merge.append(w);
            l.removeAll(w);
        }
        else
            m_orderedWindows.removeAll(w);
    }
    // rest at the end
    merge += l;

    // setup new windows
    foreach (Window w, merge)
    {
        if (!xfitMan().acceptWindow(w))
        {
            continue;
        }
        QPixmap pm;
        if (! xfitMan().getClientIcon(w, pm))
            qDebug() << "No icon for:" << w << xfitMan().getName(w);

        SwitcherItem * item = new SwitcherItem(w, xfitMan().getName(w), pm, this);
        connect(item, SIGNAL(infoChanged(const QString&)),
                infoLabel, SLOT(setText(const QString&)));
        connect(item, SIGNAL(activateXWindow()), this, SLOT(activateXWindow()));
        m_list.append(item);
        m_layout->addWidget(item);
    }

    selectNextItem();

    // Warning: show() has to be called *after* setting focus. Dunno why
    // but it works now.
    if (!isVisible())
    {
        QRect desktop = QApplication::desktop()->availableGeometry(xfitMan().getActiveDesktop());
        int x, y;
        x = desktop.width()/2 - width() / 2;
        y = desktop.height()/2 - height() / 2;
        move(x, y);
        show();
    }

}
Пример #12
0
RazorAppSwitcher::AppSwitcher::AppSwitcher()
    : QWidget(0, Qt::FramelessWindowHint | Qt::Tool)
{
    setupUi(this);

    m_settings = new RazorSettings("appswitcher", this);

    installEventFilter(this);

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(close()));
    m_timer->setInterval(10000);

    m_layout = new QHBoxLayout();
    QWidget * background = new QWidget(this);
    scrollArea->setWidget(background);
    background->setLayout(m_layout);

    m_key = new QxtGlobalShortcut(this);
    m_localKey = new QShortcut(QKeySequence::fromString(DEFAULT_SHORTCUT), this, SLOT(selectNextItem()), SLOT(selectNextItem()));

    connect(m_settings, SIGNAL(settigsChanged()), this, SLOT(applySettings()));
    connect(m_key, SIGNAL(activated()), this, SLOT(handleApps()));
    
    applySettings();
}