コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: uly55e5/PCover
void MainWindow::createActions()
{
    _openM3UAct = new QAction( tr( "M3U-&Playlist öffnen" ), this );
    _openM3UAct->setShortcut( tr( "Ctrl+O" ) );
    _openM3UAct->setStatusTip( tr( "Öffnet die Playlist zur Erstellung des Covers" ) );

    _saveCoverAct = new QAction( tr( "Cover speichern" ), this);
    _saveCoverAct->setShortcut( tr( "Ctrl+S" ) );
    _saveCoverAct->setStatusTip( tr( "Speichert das aktuelle Cover") );
    _saveCoverAct->setDisabled(TRUE);

    _savePlaylistAct = new QAction( tr( "Playlist als Text speichern" ), this);
    _savePlaylistAct->setShortcut( tr( "Ctrl+P" ) );
    _savePlaylistAct->setStatusTip( tr( "Speichert die aktuelle Playlist") );
    _savePlaylistAct->setDisabled(TRUE);

    _formatAlignmentAct = new QAction(tr( "Anordnung..." ),this);
    _formatAlignmentAct->setShortcut(tr ("Ctrl+A"));
    _formatAlignmentAct->setStatusTip(tr( "Anordnung der Einzelcover" ));
    _formatAlignmentAct->setDisabled(TRUE);

    _formatSizeColorAct = new QAction(tr("Größe und Farbe..."),this);
    _formatSizeColorAct->setStatusTip(tr("Einstellung von Größen und Farben"));
    _formatSizeColorAct->setDisabled(TRUE);

    _toolTextAct = new QAction(tr("Text..."),this);


    connect(_openM3UAct, SIGNAL(triggered()), this, SLOT(openM3UFile()));
    connect(_saveCoverAct, SIGNAL(triggered()), this, SLOT(saveCover()));
    connect(_savePlaylistAct, SIGNAL(triggered()), this, SLOT(savePlaylist()));
    connect(_formatAlignmentAct, SIGNAL(triggered()), this, SLOT(formatAlignment()));
    connect(_formatSizeColorAct, SIGNAL(triggered()), this, SLOT(setSizeColor()));
    connect(_toolTextAct, SIGNAL(triggered()), this, SLOT(setText()));
}
コード例 #2
0
ファイル: playlistedit.cpp プロジェクト: pfedick/winmusik
void PlaylistEdit::on_coverLoadButton_clicked()
{
	ppl6::CString Dir=wm->conf.LastCoverPath+"/";
	if (Dir.IsEmpty()) {
		Dir=QDir::homePath();
	}
	QString newfile = QFileDialog::getOpenFileName(this, tr("Select cover image"),
			Dir,
			tr("Images (*.png *.bmp *.jpg)"));
	if (newfile.isNull()) return;

	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
	wm->conf.LastCoverPath=ppl6::GetPath(newfile);
	wm->conf.Save();
	if (!Cover.load(newfile)) {
		QApplication::restoreOverrideCursor();
		QMessageBox::critical(this,tr("Error: could not load Cover"),
				tr("The specified file could not be loaded.\nPlease check if the file exists, is readable and contains an image format, which is supported by WinMusik (.png, .jpg or .bmp)")
				);
		return;
	} else {
		saveCover(Filename,Cover);
		QApplication::restoreOverrideCursor();
		updateCover();
	}
}
コード例 #3
0
ファイル: playlistedit.cpp プロジェクト: pfedick/winmusik
void PlaylistEdit::on_coverInsertButton_clicked()
{
	QClipboard *clipboard = QApplication::clipboard();
	if (!clipboard) return;
	if (clipboard->pixmap().isNull()) return;
	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
	Cover=clipboard->pixmap();
	saveCover(Filename,Cover);
	updateCover();
	QApplication::restoreOverrideCursor();
}
コード例 #4
0
ファイル: SearchDialog.cpp プロジェクト: ivareske/TagEditor
void SearchDialog::saveCoverNow(){
    int ind = searchResults->currentRow();
    if(ind==-1){
        return;
    }
    Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
    if(album.images().size()==0){
        return;
    }
    QList<QUrl> images = album.images();
    saveCover( images[currentCoverInd] );
}
コード例 #5
0
ファイル: SearchDialog.cpp プロジェクト: ivareske/TagEditor
void SearchDialog::save(){


    QString log;
    int aind = searchResults->currentRow();
    if(aind==-1){
        QMessageBox::critical(this, "Save", "Please select a serach result first", QMessageBox::Ok, QMessageBox::Ok);
        return;
    }
    Album album = albums_[searchResults->currentItem()->data(Qt::UserRole).toString()];
    //save tags
    bool trackOk;bool yearOk; QHash<QString,QString> commentsList;
    for(int i=0;i<albumInfo->rowCount();i++){
        qDebug()<<i;
        if( !albumInfo->item(i,TableWidget::FILE_NAME) ){
            continue;
        }
        if( albumInfo->item(i,TableWidget::FILE_NAME)->text().isEmpty() ){
            continue;
        }
        if(albumInfo->item(i,TableWidget::FILE_NAME)->checkState()!=Qt::Checked){
            continue;
        }
        QString fullfile = albumInfo->item(i,TableWidget::FILE_NAME)->data(Qt::UserRole).toString();
        TagItem* tagItem = 0;
        for(int j=0;j<items_.size();j++){
            qDebug()<<items_[j]->fileInfo().filePath().toLower()<<fullfile;
            if(items_[j]->fileInfo().filePath().toLower()==fullfile.toLower()){
                tagItem = items_[j];
                break;
            }
        }
        if(tagItem==0){
            qDebug()<<"BUG!!!!! COULD NOT FIND "+fullfile;
            continue;
        }

        if( !tagItem->tagOk() ){
            log.append("\nCould not read tag for "+fullfile);
            continue;
        }

        qDebug()<<"saving "<<fullfile;
        //title
        if(albumInfo->item(i,TableWidget::TITLE)){
            tagItem->setTitle( albumInfo->item(i,TableWidget::TITLE)->text() );
        }

        //track
        if(albumInfo->item(i,TableWidget::TRACK)){
            int tmp = albumInfo->item(i,TableWidget::TRACK)->text().toInt(&trackOk,10);
            if(trackOk){
                tagItem->setTrack( tmp );
            }
        }
        //add extra info to comments if checked
        QString comments = "";
        if( albumInfo->item(i,TableWidget::COMMENT) && !clearPreviousComentsCheckBox->isChecked() ){
            comments = albumInfo->item(i,TableWidget::COMMENT)->text();
        }
        QString tmp="Format: "+formatLineEdit->text();
        if(formatLabel->isVisible() && formatLabel->isChecked() && !comments.contains(tmp) && !formatLineEdit->text().isEmpty() ){
            if(!comments.isEmpty()){ comments.append("\n"); }
            comments.append(tmp);
        }
        tmp="Country: "+countryLineEdit->text();
        if(countryLabel->isVisible() && countryLabel->isChecked() && !comments.contains(tmp) && !countryLineEdit->text().isEmpty() ){
            if(!comments.isEmpty()){ comments.append("\n"); }
            comments.append(tmp);
        }
        tmp="Label: "+labelLineEdit->text();
        if(labelLabel->isVisible() && labelLabel->isChecked() && !comments.contains(tmp) && !labelLineEdit->text().isEmpty() ){
            if(!comments.isEmpty()){ comments.append("\n"); }
            comments.append(tmp);
        }
        tmp="Roles: "+rolesTextEdit->toPlainText();
        if(rolesLabel->isVisible() && rolesLabel->isChecked() && !comments.contains(tmp) && !rolesTextEdit->toPlainText().isEmpty() ){
            if(!comments.isEmpty()){ comments.append("\n"); }
            comments.append(tmp);
        }
        tmp="Notes: "+notesTextEdit->toPlainText();
        if(notesLabel->isVisible() && notesLabel->isChecked() && !comments.contains(tmp) && !notesTextEdit->toPlainText().isEmpty() ){
            if(!comments.isEmpty()){ comments.append("\n"); }
            comments.append(tmp);
        }
        commentsList.insert(fullfile,comments);
        //comments
        if(albumInfo->item(i,TableWidget::COMMENT)){
            tagItem->setComment( comments );
        }
        //album
        if(albumLabel->isChecked()){
            tagItem->setAlbum( albumLineEdit->text() );
        }
        //artist
        if(artistLabel->isChecked()){
            tagItem->setArtist( artistLineEdit->text() );
        }
        //genre
        if(genreLabel->isVisible() && genreLabel->isChecked()){
            tagItem->setGenre( genreLineEdit->text() );
        }
        //year
        if(yearLabel->isChecked()){
            int tmp = yearLineEdit->text().toInt(&yearOk,10);
            if(yearOk){                
                tagItem->setYear( tmp );
            }            
        }
        bool saveOk = tagItem->saveTag();
        if(!saveOk){
            log.append("\nCould not save tag for "+fullfile);
        }
    }

    //at last, update saved data in table and labels
    setItems();

    //save covers at last, in case tags are used to name covers
    if( saveCoverCheckBox->isChecked() && !saveAllCoversCheckBox->isChecked() ){
        if( currentCoverInd>=0 && currentCoverInd<album.images().size() ){
            QList<QUrl> images = album.images();
            saveCover( images[currentCoverInd] );
        }
    }else if( saveAllCoversCheckBox->isChecked() ){
	//save all covers
        QList<QUrl> images = album.images();
        for(int i=0;i<images.size();i++){
            saveCover( images[i] );
        }
    }
    //show log if any
    if(!log.isEmpty()){
        TextViewer t(log);
        t.exec();
    }
    info->setText("Tags saved");
    //albumInfo->setSortingEnabled(enabled);
}