Exemplo n.º 1
0
PortOwnerGraphicsItem::PortOwnerGraphicsItem(PropertyOwner* propertyOwner, NetworkEditor* networkEditor)
    : PropertyOwnerGraphicsItem(propertyOwner, networkEditor)
    , nameLabel_("",this)
    , progressBar_(0)
    , widgetToggleButton_(this)
    , propertyListButton_(this)
    , currentLinkArrow_(0)
{
    tgtAssert(networkEditor, "passed null pointer");
    setFlag(QGraphicsItem::ItemSendsGeometryChanges);

    setContextMenuActions();

    setParent(networkEditor);
    networkEditor->scene()->addItem(this);

    setZValue(ZValuesPortOwnerGraphicsItem);

    QObject::connect(&nameLabel_, SIGNAL(renameFinished()), this, SLOT(renameFinished()));
    QObject::connect(&nameLabel_, SIGNAL(textChanged()), this, SLOT(nameChanged()));
    QObject::connect(&propertyListButton_, SIGNAL(pressed()), this, SLOT(togglePropertyList()));
    QObject::connect(&widgetToggleButton_, SIGNAL(pressed()), this, SLOT(toggleProcessorWidget()));
    widgetToggleButton_.hide();
    propertyListButton_.hide();
}
void MusicSongsListPlayWidget::setChangItemName(const QString &name)
{
    m_songNameLabel->setText(QFontMetrics(font()).elidedText(name, Qt::ElideRight, 180));
    m_songNameLabel->setToolTip(name);
    emit renameFinished(name);
    delete m_renameLine;
    m_renameLine = nullptr;
}
void MusicSongsListPlayWidget::setItemRename()
{
    m_renameLine = new MusicSongsToolItemRenamedWidget(0, m_songNameLabel->toolTip(), this);
    connect(m_renameLine, SIGNAL(renameFinished(QString)), SLOT(setChangItemName(QString)));
    m_renameLine->setFixedSize(182, 25);
    m_renameLine->setGeometry(65, 5, 182, 25);
    m_renameLine->show();
}
Exemplo n.º 4
0
void TextGraphicsItem::keyPressEvent(QKeyEvent* event) {
    event->accept();
    if (event->key() == Qt::Key_Escape) {
        // restore saved text
        setPlainText(previousText_);
        emit textChanged();
        emit renameFinished();
    }
    else if ((event->key() == Qt::Key_Return) && (event->modifiers() == Qt::NoModifier)) {
        previousText_ = toPlainText();
        setPlainText(previousText_); // clears the selection as textCursor().clearSelection() should
        emit textChanged();
        emit renameFinished();
    }
    else {
        QGraphicsTextItem::keyPressEvent(event);
        emit textChanged();
    }
}
Exemplo n.º 5
0
bool FxLine::eventFilter( QObject *dist, QEvent *event )
{
	// If we are in a rename, capture the enter/return events and handle them
	if ( event->type() == QEvent::KeyPress )
	{
		QKeyEvent * keyEvent = static_cast<QKeyEvent*>(event);
		if( keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return )
		{
			if( m_inRename )
			{
				renameFinished();
				event->accept(); // Stop the event from propagating
				return true;
			}
		}
	}
	return false;
}
void MusicSongsSummarizied::changItemName()
{
    int index = currentIndex();
    if(index == 0 || index == 1 || index == 2)
    {
        MusicMessageBox message;
        message.setText(tr("The origin one can't rename!"));
        message.exec();
        return;//Not allow to change name for the origin three item
    }
    if(!m_renameLine)
    {
        m_renameIndex = currentIndex();
        m_renameLine =new MusicSongsToolItemRenamedWidget(m_renameIndex*26,
                                  QToolBox::itemText(m_renameIndex), this);
        connect(m_renameLine, SIGNAL(renameFinished(QString)), SLOT(setChangItemName(QString)));
        m_renameLine->show();
    }
}
MusicSongsListPlayWidget::MusicSongsListPlayWidget(int index, QWidget *parent)
    : MusicSongsEnterPlayWidget(index, parent), m_renameLine(nullptr)
{
    m_totalTime = "/00:00";

    m_artPictureLabel = new QLabel(this);
    m_artPictureLabel->setFixedSize(60, 60);
    m_artPictureLabel->setAttribute(Qt::WA_TranslucentBackground);
    m_artPictureLabel->setGeometry(0, 0, 60, 60);

    m_songNameLabel = new QLabel(this);
    m_songNameLabel->setFixedSize(202, 25);
    m_songNameLabel->setAttribute(Qt::WA_TranslucentBackground);
    m_songNameLabel->setStyleSheet(MusicUIObject::MCustomStyle11);
    m_songNameLabel->setGeometry(65, 5, 182, 25);

    m_timeLabel = new QLabel(this);
    m_timeLabel->setFixedSize(100, 20);
    m_timeLabel->setAttribute(Qt::WA_TranslucentBackground);
    m_timeLabel->setStyleSheet(MusicUIObject::MCustomStyle11);
    m_timeLabel->setGeometry(65, 37, 100, 20);

    m_columnOne = new MusicSongsEnterPlayWidget(index, this);
    m_columnThree = new MusicSongsEnterPlayWidget(index, this);

    m_loveButton = new QPushButton(this);
    m_loveButton->setGeometry(214, 35, 23, 23);
    m_loveButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 );
    m_loveButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_loveButton->setToolTip(tr("bestlove"));
    currentLoveStateClicked();

    m_deleteButton = new QPushButton(this);
    m_deleteButton->setGeometry(235, 35, 23, 23);
    m_deleteButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 );
    m_deleteButton->setIcon(QIcon(":/image/musicdelete"));
    m_deleteButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_deleteButton->setToolTip(tr("deleteMusic"));

    m_downloadButton = new QPushButton(this);
    m_downloadButton->setGeometry(170, 35, 23, 23);
    m_downloadButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 );
    m_downloadButton->setIconSize(QSize(23, 23));
    m_downloadButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_downloadButton->setToolTip(tr("songDownload"));
    currentDownloadStateClicked();

    m_showMVButton = new QPushButton(m_columnThree);
    m_showMVButton->setGeometry(0, 35, 23, 23);
    m_showMVButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 );
    m_showMVButton->setIcon(QIcon(":/share/showMV2"));
    m_showMVButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_showMVButton->setToolTip(tr("showMV"));

    m_songShareButton = new QPushButton(m_columnThree);
    m_songShareButton->setGeometry(0, 7, 23, 23);
    m_songShareButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 );
    m_songShareButton->setIcon(QIcon(":/image/songShare"));
    m_songShareButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_songShareButton->setToolTip(tr("songShare"));

    connect(m_loveButton, SIGNAL(clicked()), SIGNAL(currentLoveStateChanged()));
    connect(m_downloadButton, SIGNAL(clicked()), SIGNAL(currentDownloadStateChanged()));
    connect(m_deleteButton, SIGNAL(clicked()), parent, SLOT(setDeleteItemAt()));
    connect(this, SIGNAL(renameFinished(QString)), parent, SLOT(setItemRenameFinished(QString)));
    connect(this, SIGNAL(enterChanged(int,int)), parent, SLOT(listCellEntered(int,int)));
    connect(m_columnOne, SIGNAL(enterChanged(int,int)), parent, SLOT(listCellEntered(int,int)));
    connect(m_columnThree, SIGNAL(enterChanged(int,int)), parent, SLOT(listCellEntered(int,int)));
    connect(m_showMVButton, SIGNAL(clicked()), SLOT(showMVButtonClicked()));
    connect(m_songShareButton, SIGNAL(clicked()), SLOT(sharingButtonClicked()));

    M_CONNECTION->setValue("MusicSongsListPlayWidget", this);
    M_CONNECTION->poolConnect("MusicSongsListPlayWidget", "MusicRightAreaWidget");
    M_CONNECTION->poolConnect("MusicSongsListPlayWidget", "MusicApplication");
    M_CONNECTION->poolConnect("MusicLeftAreaWidget", "MusicSongsListPlayWidget");
}
Exemplo n.º 8
0
FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex ) :
	QWidget( _parent ),
	m_mv( _mv ),
	m_channelIndex( _channelIndex ),
	m_backgroundActive( Qt::SolidPattern ),
	m_strokeOuterActive( 0, 0, 0 ),
	m_strokeOuterInactive( 0, 0, 0 ),
	m_strokeInnerActive( 0, 0, 0 ),
	m_strokeInnerInactive( 0, 0, 0 ),
	m_inRename( false )
{
	if( !s_sendBgArrow )
	{
		s_sendBgArrow = new QPixmap( embed::getIconPixmap( "send_bg_arrow", 29, 56 ) );
	}
	if( !s_receiveBgArrow )
	{
		s_receiveBgArrow = new QPixmap( embed::getIconPixmap( "receive_bg_arrow", 29, 56 ) );
	}

	setFixedSize( 33, FxLineHeight );
	setAttribute( Qt::WA_OpaquePaintEvent, true );
	setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) );

	// mixer sends knob
	m_sendKnob = new Knob( knobBright_26, this, tr( "Channel send amount" ) );
	m_sendKnob->move( 3, 22 );
	m_sendKnob->setVisible( false );

	// send button indicator
	m_sendBtn = new SendButtonIndicator( this, this, m_mv );
	m_sendBtn->move( 2, 2 );

	// channel number
	m_lcd = new LcdWidget( 2, this );
	m_lcd->setValue( m_channelIndex );
	m_lcd->move( 4, 58 );
	m_lcd->setMarginWidth( 1 );
	
	setWhatsThis( tr(
	"The FX channel receives input from one or more instrument tracks.\n "
	"It in turn can be routed to multiple other FX channels. LMMS automatically "
	"takes care of preventing infinite loops for you and doesn't allow making "
	"a connection that would result in an infinite loop.\n\n"
	
	"In order to route the channel to another channel, select the FX channel "
	"and click on the \"send\" button on the channel you want to send to. "
	"The knob under the send button controls the level of signal that is sent "
	"to the channel.\n\n"
	
	"You can remove and move FX channels in the context menu, which is accessed "
	"by right-clicking the FX channel.\n" ) );

	QString name = Engine::fxMixer()->effectChannel( m_channelIndex )->m_name;
	setToolTip( name );

	m_renameLineEdit = new QLineEdit();
	m_renameLineEdit->setText( name );
	m_renameLineEdit->setFixedWidth( 65 );
	m_renameLineEdit->setFont( pointSizeF( font(), 7.5f ) );
	m_renameLineEdit->setReadOnly( true );

	QGraphicsScene * scene = new QGraphicsScene();
	scene->setSceneRect( 0, 0, 33, FxLineHeight );

	m_view = new QGraphicsView( this );
	m_view->setStyleSheet( "border-style: none; background: transparent;" );
	m_view->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	m_view->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	m_view->setAttribute( Qt::WA_TransparentForMouseEvents, true );
	m_view->setScene( scene );

	QGraphicsProxyWidget * proxyWidget = scene->addWidget( m_renameLineEdit );
	proxyWidget->setRotation( -90 );
	proxyWidget->setPos( 8, 145 );

	connect( m_renameLineEdit, SIGNAL( editingFinished() ), this, SLOT( renameFinished() ) );
}
Exemplo n.º 9
0
FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex ) :
	QWidget( _parent ),
	m_mv( _mv ),
	m_channelIndex( _channelIndex ),
	m_backgroundActive( Qt::SolidPattern ),
	m_strokeOuterActive( 0, 0, 0 ),
	m_strokeOuterInactive( 0, 0, 0 ),
	m_strokeInnerActive( 0, 0, 0 ),
	m_strokeInnerInactive( 0, 0, 0 ),
	m_inRename( false )
{
	if( !s_sendBgArrow )
	{
		s_sendBgArrow = new QPixmap( embed::getIconPixmap( "send_bg_arrow", 29, 56 ) );
	}
	if( !s_receiveBgArrow )
	{
		s_receiveBgArrow = new QPixmap( embed::getIconPixmap( "receive_bg_arrow", 29, 56 ) );
	}

	setFixedSize( 33, FxLineHeight );
	setAttribute( Qt::WA_OpaquePaintEvent, true );
	setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) );

	// mixer sends knob
	m_sendKnob = new Knob( knobBright_26, this, tr( "Channel send amount" ) );
	m_sendKnob->move( 3, 22 );
	m_sendKnob->setVisible( false );

	// send button indicator
	m_sendBtn = new SendButtonIndicator( this, this, m_mv );
	m_sendBtn->move( 2, 2 );

	// channel number
	m_lcd = new LcdWidget( 2, this );
	m_lcd->setValue( m_channelIndex );
	m_lcd->move( 4, 58 );
	m_lcd->setMarginWidth( 1 );
	
	QString name = Engine::fxMixer()->effectChannel( m_channelIndex )->m_name;
	setToolTip( name );

	m_renameLineEdit = new QLineEdit();
	m_renameLineEdit->setText( name );
	m_renameLineEdit->setFixedWidth( 65 );
	m_renameLineEdit->setFont( pointSizeF( font(), 7.5f ) );
	m_renameLineEdit->setReadOnly( true );
	m_renameLineEdit->installEventFilter( this );

	QGraphicsScene * scene = new QGraphicsScene();
	scene->setSceneRect( 0, 0, 33, FxLineHeight );

	m_view = new QGraphicsView( this );
	m_view->setStyleSheet( "border-style: none; background: transparent;" );
	m_view->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	m_view->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	m_view->setAttribute( Qt::WA_TransparentForMouseEvents, true );
	m_view->setScene( scene );

	QGraphicsProxyWidget * proxyWidget = scene->addWidget( m_renameLineEdit );
	proxyWidget->setRotation( -90 );
	proxyWidget->setPos( 8, 145 );

	connect( m_renameLineEdit, SIGNAL( editingFinished() ), this, SLOT( renameFinished() ) );
}