void LauncherScene::setEditMode(bool b) { if (m_isEditMode == b) { return; } m_isEditMode = b; m_isEditMode?enterEditMode():exitEditMode(); }
void PlaylistComponent::onEditModeStateChanged() { if (treeWidget_.editMode()) { if (noChanges()) cancelChanges(true); else { if (! leaveAskChangedEditMode()) actions_.playlist.editMode->setChecked(true); } } else enterEditMode(); }
void CDlgAnalNystag::OnNMDblclkListAnResultDetail(NMHDR *pNMHDR, LRESULT *pResult) { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. LPNMITEMACTIVATE temp = (LPNMITEMACTIVATE) pNMHDR; long lRow = 0; // 로우 int nCol = 0; // 컬럼 lRow = temp->iItem; // 로우값(더블클릭한 로우리턴) nCol = temp->iSubItem; // 컬럼값(더블클릭한 컬럼리턴 : 님 경우 별 쓸모없겠지만..) enterEditMode(true, lRow); }
bool PlaylistComponent::enterAskEditMode() { const auto selectedButton = inputController_.showMessage( editModeTitle(), tr("Enter playlist edit mode?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No, QMessageBox::Question); if (selectedButton == QMessageBox::Yes) { enterEditMode(); return true; } return false; }
/* * Clear all the metadata widgets */ void MetaPanel::clear() { title_text->clear(); artist_text->clear(); genre_text->clear(); copyright_text->clear(); collection_text->clear(); seqnum_text->clear(); seqtot_text->clear(); disconnect( description_text, SIGNAL(textChanged()), this, SLOT(enterEditMode()) ); description_text->clear(); CONNECT( description_text, textChanged(), this, enterEditMode() ); date_text->clear(); language_text->clear(); nowplaying_text->clear(); publisher_text->clear(); encodedby_text->clear(); art_cover->clear(); fingerprintButton->setVisible( false ); setEditMode( false ); emit uriSet( "" ); }
/** * First Panel - Meta Info * All the usual MetaData are displayed and can be changed. **/ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) : QWidget( parent ), p_intf( _p_intf ) { QGridLayout *metaLayout = new QGridLayout( this ); metaLayout->setVerticalSpacing( 0 ); QFont smallFont = QApplication::font(); smallFont.setPointSize( smallFont.pointSize() - 1 ); smallFont.setBold( true ); int line = 0; /* Counter for GridLayout */ p_input = NULL; QLabel *label; #define ADD_META( string, widget, col, colspan ) { \ label = new QLabel( qtr( string ) ); label->setFont( smallFont ); \ label->setContentsMargins( 3, 2, 0, 0 ); \ metaLayout->addWidget( label, line++, col, 1, colspan ); \ widget = new QLineEdit; \ metaLayout->addWidget( widget, line, col, 1, colspan ); \ CONNECT( widget, textEdited( QString ), this, enterEditMode() ); \ } /* Title, artist and album*/ ADD_META( VLC_META_TITLE, title_text, 0, 10 ); line++; ADD_META( VLC_META_ARTIST, artist_text, 0, 10 ); line++; ADD_META( VLC_META_ALBUM, collection_text, 0, 7 ); /* Date */ label = new QLabel( qtr( VLC_META_DATE ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line - 1, 7, 1, 2 ); /* Date (Should be in years) */ date_text = new QLineEdit; date_text->setAlignment( Qt::AlignRight ); date_text->setInputMask("0000"); date_text->setMaximumWidth( 140 ); metaLayout->addWidget( date_text, line, 7, 1, -1 ); line++; /* Genre Name */ /* TODO List id3genres.h is not includable yet ? */ ADD_META( VLC_META_GENRE, genre_text, 0, 7 ); /* Number - on the same line */ label = new QLabel( qtr( VLC_META_TRACK_NUMBER ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line - 1, 7, 1, 3 ); seqnum_text = new QLineEdit; seqnum_text->setMaximumWidth( 64 ); seqnum_text->setAlignment( Qt::AlignRight ); metaLayout->addWidget( seqnum_text, line, 7, 1, 1 ); label = new QLabel( "/" ); label->setFont( smallFont ); metaLayout->addWidget( label, line, 8, 1, 1 ); seqtot_text = new QLineEdit; seqtot_text->setMaximumWidth( 64 ); seqtot_text->setAlignment( Qt::AlignRight ); metaLayout->addWidget( seqtot_text, line, 9, 1, 1 ); line++; /* Rating - on the same line */ /* metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) ), line, 4, 1, 2 ); rating_text = new QSpinBox; setSpinBounds( rating_text ); metaLayout->addWidget( rating_text, line, 6, 1, 1 ); */ /* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */ ADD_META( VLC_META_NOW_PLAYING, nowplaying_text, 0, 7 ); nowplaying_text->setReadOnly( true ); line--; /* Language on the same line */ ADD_META( VLC_META_LANGUAGE, language_text, 7, -1 ); line++; ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); fingerprintButton = new QPushButton( qtr("&Fingerprint") ); fingerprintButton->setToolTip( qtr( "Find meta data using audio fingerprinting" ) ); fingerprintButton->setVisible( false ); metaLayout->addWidget( fingerprintButton, line, 7 , 3, -1 ); CONNECT( fingerprintButton, clicked(), this, fingerprint() ); line++; lblURL = new QLabel; lblURL->setOpenExternalLinks( true ); lblURL->setTextFormat( Qt::RichText ); metaLayout->addWidget( lblURL, line -1, 7, 1, -1 ); ADD_META( VLC_META_COPYRIGHT, copyright_text, 0, 7 ); line++; /* ART_URL */ art_cover = new CoverArtLabel( this, p_intf ); metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignLeft ); ADD_META( VLC_META_ENCODED_BY, encodedby_text, 0, 7 ); line++; label = new QLabel( qtr( N_("Comments") ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line++, 0, 1, 7 ); description_text = new QTextEdit; description_text->setAcceptRichText( false ); metaLayout->addWidget( description_text, line, 0, 1, 7 ); // CONNECT( description_text, textChanged(), this, enterEditMode() ); //FIXME line++; /* VLC_META_SETTING: Useless */ /* ADD_META( TRACKID ) Useless ? */ /* ADD_URI - Do not show it, done outside */ metaLayout->setColumnStretch( 1, 20 ); metaLayout->setColumnMinimumWidth ( 1, 80 ); metaLayout->setRowStretch( line, 10 ); #undef ADD_META CONNECT( seqnum_text, textEdited( QString ), this, enterEditMode() ); CONNECT( seqtot_text, textEdited( QString ), this, enterEditMode() ); CONNECT( date_text, textEdited( QString ), this, enterEditMode() ); // CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() ); /* CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/ /* We are not yet in Edit Mode */ b_inEditMode = false; }
/** * First Panel - Meta Info * All the usual MetaData are displayed and can be changed. **/ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) : QWidget( parent ), p_intf( _p_intf ) { QGridLayout *metaLayout = new QGridLayout( this ); metaLayout->setVerticalSpacing( 12 ); int line = 0; /* Counter for GridLayout */ p_input = NULL; #define ADD_META( string, widget ) { \ metaLayout->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \ widget = new QLineEdit; \ metaLayout->addWidget( widget, line, 1, 1, 9 ); \ line++; } /* Title, artist and album*/ ADD_META( VLC_META_TITLE, title_text ); /* OK */ ADD_META( VLC_META_ARTIST, artist_text ); /* OK */ ADD_META( VLC_META_ALBUM, collection_text ); /* OK */ /* Genre Name */ /* TODO List id3genres.h is not includable yet ? */ genre_text = new QLineEdit; metaLayout->addWidget( new QLabel( qtr( VLC_META_GENRE ) + " :" ), line, 0 ); metaLayout->addWidget( genre_text, line, 1, 1, 3 ); /* Number - on the same line */ metaLayout->addWidget( new QLabel( qtr( VLC_META_TRACK_NUMBER ) + " :" ), line, 5, 1, 2 ); seqnum_text = new QLineEdit; seqnum_text->setInputMask("0000"); seqnum_text->setAlignment( Qt::AlignRight ); metaLayout->addWidget( seqnum_text, line, 7, 1, 3 ); line++; /* Date (Should be in years) */ date_text = new QLineEdit; date_text->setInputMask("0000"); date_text->setAlignment( Qt::AlignRight ); metaLayout->addWidget( new QLabel( qtr( VLC_META_DATE ) + " :" ), line, 0 ); metaLayout->addWidget( date_text, line, 1, 1, 3 ); /* Rating - on the same line */ /* metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) + " :" ), line, 4, 1, 2 ); rating_text = new QSpinBox; setSpinBounds( rating_text ); metaLayout->addWidget( rating_text, line, 6, 1, 1 ); */ /* Language on the same line */ metaLayout->addWidget( new QLabel( qfu( VLC_META_LANGUAGE ) + " :" ), line, 5, 1, 2 ); language_text = new QLineEdit; language_text->setReadOnly( true ); metaLayout->addWidget( language_text, line, 7, 1, 3 ); line++; /* ART_URL */ art_cover = new CoverArtLabel( this, p_intf ); metaLayout->addWidget( art_cover, line, 8, 4, 2, Qt::AlignRight ); /* Settings is unused */ /* l->addWidget( new QLabel( qtr( VLC_META_SETTING ) + " :" ), line, 5 ); setting_text = new QLineEdit; l->addWidget( setting_text, line, 6, 1, 4 ); */ /* Less used metadata */ #define ADD_META_2( string, widget ) { \ metaLayout->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \ widget = new QLineEdit; \ metaLayout->addWidget( widget, line, 1, 1, 7 ); \ line++; } /* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */ ADD_META_2( VLC_META_NOW_PLAYING, nowplaying_text ); nowplaying_text->setReadOnly( true ); ADD_META_2( VLC_META_PUBLISHER, publisher_text ); ADD_META_2( VLC_META_COPYRIGHT, copyright_text ); ADD_META_2( N_("Comments"), description_text ); /* useless metadata */ //ADD_META_2( VLC_META_ENCODED_BY, encodedby_text ); /* ADD_META( TRACKID ) Useless ? */ /* ADD_URI - DO not show it, done outside */ metaLayout->setColumnStretch( 1, 2 ); metaLayout->setColumnMinimumWidth ( 1, 80 ); metaLayout->setRowStretch( line, 10 ); #undef ADD_META #undef ADD_META_2 CONNECT( title_text, textEdited( QString ), this, enterEditMode() ); CONNECT( artist_text, textEdited( QString ), this, enterEditMode() ); CONNECT( collection_text, textEdited( QString ), this, enterEditMode() ); CONNECT( genre_text, textEdited( QString ), this, enterEditMode() ); CONNECT( seqnum_text, textEdited( QString ), this, enterEditMode() ); CONNECT( date_text, textEdited( QString ), this, enterEditMode() ); CONNECT( description_text, textEdited( QString ), this, enterEditMode() ); /* CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/ /* We are not yet in Edit Mode */ b_inEditMode = false; }
void PopupMenuEditor::keyPressEvent( QKeyEvent * e ) { if ( lineEdit->isHidden() ) { // In navigation mode switch ( e->key() ) { case Qt::Key_Delete: hideSubMenu(); removeItem(); showSubMenu(); break; case Qt::Key_Backspace: clearCurrentField(); break; case Qt::Key_Up: navigateUp( e->state() & Qt::ControlButton ); break; case Qt::Key_Down: navigateDown( e->state() & Qt::ControlButton ); break; case Qt::Key_Left: navigateLeft(); break; case Qt::Key_Right: navigateRight(); break; case Qt::Key_PageUp: currentIndex = 0; break; case Qt::Key_PageDown: currentIndex = itemList.count(); break; case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_F2: enterEditMode( e ); // move on case Qt::Key_Alt: case Qt::Key_Shift: case Qt::Key_Control: // do nothing return; case Qt::Key_Escape: currentField = 0; navigateLeft(); break; case Qt::Key_C: if ( e->state() & Qt::ControlButton && currentIndex < (int)itemList.count() ) { copy( currentIndex ); break; } case Qt::Key_X: if ( e->state() & Qt::ControlButton && currentIndex < (int)itemList.count() ) { hideSubMenu(); cut( currentIndex ); showSubMenu(); break; } case Qt::Key_V: if ( e->state() & Qt::ControlButton ) { hideSubMenu(); paste( currentIndex < (int)itemList.count() ? currentIndex + 1: itemList.count() ); showSubMenu(); break; } default: if ( currentItem()->isSeparator() ) return; if ( currentField == 1 ) { showLineEdit(); QApplication::sendEvent( lineEdit, e ); e->accept(); return; } else if ( currentField == 2 ) { setAccelerator( e->key(), e->state() ); showSubMenu(); } break; } } else { // In edit mode switch ( e->key() ) { case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_Escape: leaveEditMode( e ); e->accept(); return; } } update(); }
/** * Update all the MetaData and art on an "item-changed" event **/ void MetaPanel::update( input_item_t *p_item ) { if( !p_item ) { clear(); return; } /* Don't update if you are in edit mode */ if( b_inEditMode ) return; p_input = p_item; char *psz_meta; #define UPDATE_META( meta, widget ) { \ psz_meta = input_item_Get##meta( p_item ); \ widget->setText( !EMPTY_STR( psz_meta ) ? qfu( psz_meta ) : "" ); \ free( psz_meta ); } #define UPDATE_META_INT( meta, widget ) { \ psz_meta = input_item_Get##meta( p_item ); \ if( !EMPTY_STR( psz_meta ) ) \ widget->setValue( atoi( psz_meta ) ); } \ free( psz_meta ); /* Name / Title */ psz_meta = input_item_GetTitleFbName( p_item ); if( psz_meta ) { title_text->setText( qfu( psz_meta ) ); free( psz_meta ); } else title_text->setText( "" ); /* URL / URI */ psz_meta = input_item_GetURI( p_item ); if( !EMPTY_STR( psz_meta ) ) emit uriSet( qfu( psz_meta ) ); fingerprintButton->setVisible( Chromaprint::isSupported( QString( psz_meta ) ) ); free( psz_meta ); /* Other classic though */ UPDATE_META( Artist, artist_text ); UPDATE_META( Genre, genre_text ); UPDATE_META( Copyright, copyright_text ); UPDATE_META( Album, collection_text ); disconnect( description_text, SIGNAL(textChanged()), this, SLOT(enterEditMode()) ); UPDATE_META( Description, description_text ); CONNECT( description_text, textChanged(), this, enterEditMode() ); UPDATE_META( Language, language_text ); UPDATE_META( NowPlaying, nowplaying_text ); UPDATE_META( Publisher, publisher_text ); UPDATE_META( EncodedBy, encodedby_text ); UPDATE_META( Date, date_text ); UPDATE_META( TrackNum, seqnum_text ); UPDATE_META( TrackTotal, seqtot_text ); // UPDATE_META( Setting, setting_text ); // UPDATE_META_INT( Rating, rating_text ); /* URL */ psz_meta = input_item_GetURL( p_item ); if( !EMPTY_STR( psz_meta ) ) { QString newURL = qfu(psz_meta); if( currentURL != newURL ) { currentURL = newURL; lblURL->setText( "<a href='" + currentURL + "'>" + currentURL.remove( QRegExp( ".*://") ) + "</a>" ); } } free( psz_meta ); #undef UPDATE_META_INT #undef UPDATE_META // If a artURL is available as a local file, directly display it ! QString file; char *psz_art = input_item_GetArtURL( p_item ); if( psz_art ) { char *psz = make_path( psz_art ); free( psz_art ); file = qfu( psz ); free( psz ); } art_cover->showArtUpdate( file ); art_cover->setItem( p_item ); }
KeySequenceEdit::KeySequenceEdit(QWidget *parent) : QPushButton(parent), mSequence("") { setText("[Enter sequence]"); connect(this, SIGNAL(pressed()), this, SLOT(enterEditMode())); }