void CWorkspaceViewsDialog::CreateWidgets() { static const QStringList header_labels = QStringList() << tr( "Name" ) << tr( "Type" ) << tr( "Value" ); const std::string wname = mModel.RootWorkspace()->GetName(); // Create // ... Tree mViewsListWidget = new QListWidget( this ); mViewsListWidget->setSelectionBehavior( QAbstractItemView::SelectRows ); mViewsListWidget->setSelectionMode( QAbstractItemView::SingleSelection ); mViewsListWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::MinimumExpanding ); mMapsAsPlotsCheckBox = new QCheckBox( "Display maps as 3D plots" ); // ... Help auto help = new CTextWidget; help->SetHelpProperties( "All views generated by the operations of workspace " + t2q( wname ), 0, 6, Qt::AlignCenter ); auto help_group = CreateGroupBox( ELayoutType::Grid, { help }, "", nullptr, 6, 6, 6, 6, 6 ); help_group->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum ); // ... Buttons mButtonBox = new QDialogButtonBox( this ); mButtonBox->setObjectName( QString::fromUtf8( "mButtonBox" ) ); mButtonBox->setOrientation( Qt::Horizontal ); mButtonBox->setStandardButtons( QDialogButtonBox::Open | QDialogButtonBox::Cancel ); mButtonBox->button( QDialogButtonBox::Open )->setDefault( true ); QBoxLayout *main_l = LayoutWidgets( Qt::Vertical, { mViewsListWidget, mMapsAsPlotsCheckBox, help_group, mButtonBox }, this, 6, 6, 6, 6, 6 ); Q_UNUSED( main_l ); setWindowTitle( "Workspace Views - " + t2q( wname ) ); // Wrap up dimensions adjustSize(); setMinimumWidth( width() ); Wire(); }
QString bpmFromFile(QString fn) { TagLib::FileRef f(CONVFN(fn)); if (!f.file()) return QString(); //if (!f.tag()) if (TagLib::MPEG::File* mpf=dynamic_cast<TagLib::MPEG::File*>(f.file()) ) mpf->ID3v2Tag(true); if (!f.tag()) return QString(); TagLib::FLAC::File* flacf=dynamic_cast<TagLib::FLAC::File*>(f.file()); TagLib::MPEG::File* mpf=dynamic_cast<TagLib::MPEG::File*>(f.file()); if (flacf && flacf->xiphComment()) { if (flacf->xiphComment()->contains("BPM")) return t2q(flacf->xiphComment()->fieldListMap()["BPM"].toString()); } if (mpf || flacf) { TagLib::ID3v2::Tag* tag2=0; if (mpf) tag2=mpf->ID3v2Tag(true); if (flacf) tag2=flacf->ID3v2Tag(); //taglib may not be able to create it properly if (tag2) { TagLib::ID3v2::FrameListMap map=tag2->frameListMap(); if (map.contains("TBPM") && map["TBPM"].size()) return t2q(tag2->frameList("TBPM")[0]->toString())+'\n'; } } if (TagLib::MP4::File* mp4f=dynamic_cast<TagLib::MP4::File*>(f.file())) { TagLib::MP4::Tag* tag=mp4f->tag(); if (tag) { TagLib::MP4::ItemListMap& map=tag->itemListMap(); if (map.contains("tmpo")) return QString::number(map["tmpo"].toInt()); } } return QString(); }
void MediaController::metaDataChanged() { QString extra_data; QByteArray encoded = QFile::encodeName(current_file.path()); TagLib::FileRef ref(encoded.data(), true, TagLib::AudioProperties::Fast); if (ref.isNull()) { info_label->setText(i18n("Playing: <b>%1</b>", current_file.name())); return; } TagLib::Tag* tag = ref.tag(); if (!tag) { info_label->setText(i18n("Playing: <b>%1</b>", current_file.name())); return; } QString artist = t2q(tag->artist()); QString title = t2q(tag->title()); QString album = t2q(tag->album()); bool has_artist = !artist.isEmpty(); bool has_title = !title.isEmpty(); bool has_album = !album.isEmpty(); if (has_artist && has_title && has_album) { extra_data = i18n("<b>%2</b> - <b>%1</b> (Album: <b>%3</b>)", title, artist, album); info_label->setText(extra_data); } else if (has_title && has_artist) { extra_data = i18n("<b>%2</b> - <b>%1</b>", title, artist); info_label->setText(extra_data); } else if (has_title) { extra_data = i18n("<b>%1</b>", title); info_label->setText(extra_data); } else { info_label->setText(i18n("<b>%1</b>", current_file.name())); } }
void CDataDisplayPropertiesDialog::CreateWidgets() { // Vector fields mNorthComponent = new QRadioButton( "North Component" ); mEastComponent = new QRadioButton( "East Component" ); mVectorBox = CreateGroupBox( ELayoutType::Vertical, { mNorthComponent, mEastComponent }, "Vector Plot Component", nullptr ); mVectorBox->setCheckable(true); mVectorBox->setChecked(false); // ... Help auto help = new CTextWidget; QString name = t2q( mFormula->GetName() ); help->SetHelpProperties( "Edit the expression '" + name + "' display properties.\n" "Vector box is available only if a map operation has more than 1 data field.", 0 , 6 ); auto help_group = CreateGroupBox( ELayoutType::Grid, { help }, "", nullptr, 6, 6, 6, 6, 6 ); help_group->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum ); // ... Buttons mButtonBox = new QDialogButtonBox( this ); mButtonBox->setObjectName( QString::fromUtf8( "mButtonBox" ) ); mButtonBox->setOrientation( Qt::Horizontal ); mButtonBox->setStandardButtons( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); mButtonBox->button( QDialogButtonBox::Ok )->setDefault( true ); QBoxLayout *main_l = LayoutWidgets( Qt::Vertical, { mVectorBox, WidgetLine( this, Qt::Horizontal ), help_group, WidgetLine( this, Qt::Horizontal ), mButtonBox }, this, 6, 6, 6, 6, 6 ); Q_UNUSED( main_l ); // Wrap up dimensions adjustSize(); setMinimumWidth( width() ); Wire(); }
CEditTasksFileDialog::CEditTasksFileDialog( const std::string &task_name, const std::string &path, QWidget *parent ) : base_t( parent ) , mTaskName( task_name ) , mPath( path ) { CreateWidgets(); std::string title = mTaskName.empty() ? "Scheduler Tasks File: " : mTaskName + " Log: "; setWindowTitle( t2q( title + mPath ) ); }
void CEditTasksFileDialog::Wire() { mTextEdit->readFromFile( t2q( mPath ) ); mTextEdit->MoveTo( 0, false ); mTextEdit->SetReadOnlyEditor( true ); // connect connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) ); }
void CRadsDaemon::HandleProcessFinished( int exit_code, QProcess::ExitStatus exitStatus ) { COsProcess *process = qobject_cast<COsProcess*>( sender() ); assert__( process && mCurrentProcess == process ); if (exitStatus == QProcess::CrashExit) { const QString msg = "program crash"; QtServiceBase::instance()->logMessage( msg ); LOG_FATAL( msg ); } else if ( exit_code != 0 ) //this is ExitStatus::NormalExit, although error code != 0 { const QString msg = t2q( "exit code " + n2s<std::string>( exit_code ) ); QtServiceBase::instance()->logMessage( msg ); LOG_WARN( msg ); } else { LOG_INFO( "success" ); } mCurrentProcess->deleteLater(); mCurrentProcess = nullptr; }
CCoreApplication< APPLICATION, SETTINGS >::CCoreApplication( int &argc, char **argv, bool GUIenabled, QString customConfigPath ) //customConfigPath = QString() : base_t( argc, argv, GUIenabled, customConfigPath.isEmpty() ? smApplicationPaths->mInternalDataDir.c_str() : customConfigPath ) , mSettings( *smApplicationPaths, "ESA", q2t< std::string >( QgsApplication::applicationName() ) ) { LOG_TRACE( "Starting application instance construction..." ); // v4 //#ifdef WIN32 //#ifdef _DEBUG // _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); //#endif //#endif assert__( smPrologueCalled ); if ( !smPrologueCalled ) throw CException( "CCoreApplication Prologue must be called before application construction." ); CheckRunMode(); CreateSplash(); // QGIS paths // setPkgDataPath( mSettings.BratPaths().mInternalDataDir.c_str() ); // returned by QgsApplication::srsDbFilePath(); variable: mPkgDataPath LOG_TRACE( "srsDbFilePath==" + srsDbFilePath() ); LOG_TRACE( "showSettings==" + showSettings() ); LOG_TRACE( "qgisSettingsDirPath==" + qgisSettingsDirPath() ); LOG_TRACE( "qgisUserDbFilePath==" + qgisUserDbFilePath() ); //variable mConfigPath LOG_TRACEstd( "Qt plugins==" + mSettings.BratPaths().mQtPluginsDir ); LOG_TRACEstd( "QGIS plugins==" + mSettings.BratPaths().mQgisPluginsDir ); // To be sure that number have always a decimal point (and not a comma or something else) // setlocale( LC_NUMERIC, "C" ); ShowSplash( "Loading application settings..." ); // Load configuration - I // if ( !mSettings.LoadConfig() ) { throw CException( "Error reading the configuration. Settings file: " + mSettings.FilePath() ); } // Keep v3 happy // CTools::SetInternalDataDir( mSettings.BratPaths().mInternalDataDir ); assert__( CTools::DirectoryExists( CTools::GetInternalDataDir() ) ); // Register Brat algorithms // LOG_TRACE( "Registering algorithms..." ); RegisterAlgorithms(); // OpenGL // ShowSplash( "Checking OpenGL..." ); if ( mSettings.mCheckOpenGL ) { CheckOpenGL(); //throws on failure LOG_TRACE( "OpenGL check successful." ); } // Use application paths to initialize COperation internal path references // COperation::SetExecNames( mSettings.BratPaths() ); // Load physical units system // std::string errorMsg; if ( !CTools::LoadAndCheckUdUnitsSystem( errorMsg ) ) { std::cerr << errorMsg << std::endl; SimpleErrorBox( errorMsg.c_str() ); throw false; } // Load aliases dictionary // CAliasesDictionary::LoadAliasesDictionary( &errorMsg, false ); if ( !errorMsg.empty() ) { std::cerr << "WARNING: " << errorMsg << std::endl; SimpleWarnBox( errorMsg ); } // CODA - can only be done after SetInternalDataDir // assert__( CProduct::GetRefCount() <= 0 ); // CProduct::CodaInit(); // Load configuration - II - can only be done after CodaInit // if ( !mSettings.LoadConfigSelectionCriteria() ) { throw CException( "Error reading the configuration file." ); } // (*) this can be statically set, but not statically // queried before ctor call (issues Qt assertion) // #if defined (Q_OS_LINUX) mDefaultAppStyle = t2q( mSettings.getNameOfStyle( new QCleanlooksStyle, true ) ); //(*) #else mDefaultAppStyle = getCurrentStyleName(); //(*) #endif mSettings.setApplicationStyle( *this, mDefaultAppStyle ); // Load XML processor and TasksProcessor // ShowSplash( "Loading scheduled tasks processor." ); ::xercesc::XMLPlatformUtils::Initialize(); if ( !CTasksProcessor::GetInstance() ) CTasksProcessor::CreateInstance( mSettings.BratPaths().mExecutableDir ); LOG_TRACE( "Scheduled tasks processor loaded." ); //v4: remaining initialization in charge of the main window LOG_TRACE( "Finished application instance construction." ); }
void test_constructors() { cout << "test_constructors" << endl; sc_time t1; cout << t1 << endl; sc_time t2a( 0, SC_SEC ); cout << t2a << endl; sc_time t2b( 1.2345, SC_NS ); cout << t2b << endl; sc_time t2c( 1.2341, SC_NS ); cout << t2c << endl; sc_time t2d( 1, SC_FS ); cout << t2d << endl; sc_time t2e( -1.2345, SC_NS ); cout << t2e << endl; sc_time t2f( -1.2341, SC_NS ); cout << t2f << endl; char v1 = 1; signed char v2 = 2; unsigned char v3 = 3; short v4 = 4; unsigned short v5 = 5; int v6 = 6; unsigned int v7 = 7; long v8 = 8; unsigned long v9 = 9; float v10 = 10; double v11 = 11; sc_time t2g( v1, SC_NS ); cout << t2g << endl; sc_time t2h( v2, SC_NS ); cout << t2h << endl; sc_time t2i( v3, SC_NS ); cout << t2i << endl; sc_time t2j( v4, SC_NS ); cout << t2j << endl; sc_time t2k( v5, SC_NS ); cout << t2k << endl; sc_time t2l( v6, SC_NS ); cout << t2l << endl; sc_time t2m( v7, SC_NS ); cout << t2m << endl; sc_time t2n( v8, SC_NS ); cout << t2n << endl; sc_time t2o( v9, SC_NS ); cout << t2o << endl; sc_time t2p( v10, SC_NS ); cout << t2p << endl; sc_time t2q( v11, SC_NS ); cout << t2q << endl; sc_time t3a( 0, SC_SEC ); cout << t3a << endl; sc_time t3b( 1.2341, true ); cout << t3b << endl; sc_time t3c( 1.2345, true ); cout << t3c << endl; sc_time t3d( -1.2341, true ); cout << t3d << endl; sc_time t3e( -1.2345, true ); cout << t3e << endl; sc_time t3f( 1.2345, false ); cout << t3f << endl; sc_time t3g( 1.5432, false ); cout << t3g << endl; sc_time t3h( -1.2345, false ); cout << t3h << endl; sc_time t3i( -1.5432, false ); cout << t3i << endl; #if !defined( _MSC_VER ) sc_time t4a( 0ull, true ); cout << t4a << endl; sc_time t4b( 25ull, true ); cout << t4b << endl; sc_time t4c( 25ull, false ); cout << t4c << endl; #else sc_time t4a( 0ui64, true ); cout << t4a << endl; sc_time t4b( 25ui64, true ); cout << t4b << endl; sc_time t4c( 25ui64, false ); cout << t4c << endl; #endif sc_time t5( t4c ); cout << t5 << endl; }
void ReadTagsTask::run() { emit started(); for(int songI=0; songI<songData.size();songI++) { if (songI%10==0) emit progress(100*songI/songData.size()); SongData& s=songData[songI]; TagLib::AudioProperties::ReadStyle mode=s.fileDurations.count()?TagLib::AudioProperties::Accurate : TagLib::AudioProperties::Average; s.fileDurations.clear(); s.bpm.clear(); s.fileComposers.clear(); s.originalFileNames.clear(); const QStringList& list=s.matchedFileNames.count()?s.matchedFileNames:s.fuzzyMatchedFileNames; for (int fileI = 0; fileI < list.size(); ++fileI) { TagLib::FileRef f(CONVFN(QString(dirPath%"/"%list.at(fileI))), true, mode); if (!f.file() || !f.file()->audioProperties()) { qWarning()<<"bad file"<<list.at(fileI); continue; } QTime time=QTime(0,0).addSecs(f.file()->audioProperties()->length()); s.fileDurations+=time.toString("m:ss")+'\n'; QString bpm; TagLib::FLAC::File* flacf=dynamic_cast<TagLib::FLAC::File*>(f.file()); TagLib::MPEG::File* mpf=dynamic_cast<TagLib::MPEG::File*>(f.file()); if (mpf || flacf) { TagLib::ID3v2::Tag* tag2=0; if (mpf) tag2=mpf->ID3v2Tag(true); //if (flacf) tag2=flacf->ID3v2Tag(); //taglib may not be able to create it properly if (tag2) { TagLib::ID3v2::FrameListMap map=tag2->frameListMap(); if (map.contains("TBPM")) bpm=t2q(tag2->frameList("TBPM")[0]->toString())+'\n'; if (map.contains("TOFN")) s.originalFileNames+=t2q(tag2->frameList("TOFN")[0]->toString())+'\n'; if (map.contains("TCOM")) s.fileComposers+=t2q(tag2->frameList("TCOM")[0]->toString())+'\n'; } } if (TagLib::MP4::File* mp4f=dynamic_cast<TagLib::MP4::File*>(f.file())) { TagLib::MP4::Tag* tag=mp4f->tag(); if (tag) { TagLib::MP4::ItemListMap& map=tag->itemListMap(); if (map.contains("tmpo")) bpm=QString::number(map["tmpo"].toInt())+'\n'; if (map.contains("\251wrt")) s.fileComposers+=t2q(map["\251wrt"].toStringList().front())+'\n'; } } if (flacf && flacf->xiphComment()) { if (flacf->xiphComment()->contains("COMPOSER")) s.fileComposers+=t2q(flacf->xiphComment()->fieldListMap()["COMPOSER"].toString())+'\n'; if (flacf->xiphComment()->contains("BPM")) bpm=t2q(flacf->xiphComment()->fieldListMap()["BPM"].toString())+'\n'; } s.bpm+=bpm; } s.fileDurations.chop(1); s.fileComposers.chop(1); s.originalFileNames.chop(1); s.bpm.chop(1); } emit done(songData, refreshId); emit finished(); }
void WriteTagsTask::run() { emit started(); //int maxPop=findMaxPop(songData); for(int songI=0; songI<songData.size();songI++) { emit progress(100*songI/songData.size()); SongData s=songData.at(songI); for (int fileI = 0; fileI < s.matchedFileNames.size(); ++fileI) { TagLib::FileRef f(CONVFN(QString(dirPath%"/"%s.matchedFileNames.at(fileI)))); if (!f.file()) continue; //if (!f.tag()) { if (TagLib::MPEG::File* mpf=dynamic_cast<TagLib::MPEG::File*>(f.file()) ) mpf->ID3v2Tag(true); } if (!f.tag()) continue; QString fileDistinguisher=extractDistinguisher(s.matchedFileNames.at(fileI)); QString discographyDistinguisher=extractDistinguisher(deaccent(s.name)); QString discographyVocalDistinguisher=extractDistinguisher(deaccent(s.vocal)); if (discographyDistinguisher==fileDistinguisher || discographyVocalDistinguisher==fileDistinguisher) fileDistinguisher.clear(); //e.g. El once (a divertirse) (a divertirse) /* //rewrite second part after | in braces int barPos=s.name.indexOf(" | "); QString name=s.name.mid(0, barPos).trimmed(); if (barPos!=-1) name+=" ("%s.name.mid(barPos+3).trimmed()%")"; */ int barPos=s.name.indexOf(" | "); //qDebug()<<s.name.mid(0, barPos).trimmed(); QString oldAlbum=t2q(f.tag()->album()); qDebug()<<"OOO"<<oldAlbum; QString vocalA;//=s.vocal=="Instrumental"?"":(" - "+s.vocal); f.tag()->setTitle(q2t(s.name+fileDistinguisher)); //f.tag()->setArtist(q2t(orchestra)); //f.tag()->setAlbum(q2t(orchestra%" - "%s.vocal)); f.tag()->setArtist(q2t(orchestra%" - "%s.vocal)); if (orchestra.isEmpty()) f.tag()->setArtist(q2t(s.vocal)); //f.tag()->setAlbum("TngoEntropy"); if (s.genre.length()) s.genre[0]=s.genre.at(0).toUpper(); f.tag()->setGenre(q2t(s.genre)); int year=s.year.left(4).toInt(); if (year>1800) f.tag()->setYear(year); //f.tag()->setComment("TngoEntropy"); if (f.tag()->comment()=="TngoEntropy") f.tag()->setComment(""); TagLib::FLAC::File* flacf=dynamic_cast<TagLib::FLAC::File*>(f.file()); TagLib::MPEG::File* mpf=dynamic_cast<TagLib::MPEG::File*>(f.file()); if (mpf || flacf) { TagLib::ID3v1::Tag* tag1=0; if (mpf) tag1=mpf->ID3v1Tag(true); if (flacf) tag1=flacf->ID3v1Tag(); if (tag1) { tag1->setTitle(q2t(deaccent(s.name.mid(0, barPos).trimmed()+fileDistinguisher))); //tag1->setAlbum(q2t(deaccent(orchestra%" - "%s.vocal))); //tag1->setArtist(q2t(deaccent(orchestra))); tag1->setArtist(q2t(deaccent(orchestra%" - "%s.vocal))); if (orchestra.isEmpty()) tag1->setArtist(q2t(deaccent(s.vocal))); } } if (flacf) { /* TagLib::Ogg::FieldListMap map=flacf->xiphComment(true)->fieldListMap(); for (TagLib::Ogg::FieldListMap::ConstIterator it=map.begin();it!=map.end();++it) { qDebug()<<t2q((*it).first); TagLib::StringList list=(*it).second; for (int i=0;i<list.size();++i) qDebug()<<t2q(list[i]); }*/ flacf->xiphComment(true); if (oldAlbum.length() && !flacf->xiphComment()->contains("ORIGINAL ALBUM")) flacf->xiphComment()->addField("ORIGINAL ALBUM", q2t(oldAlbum)); if (s.year.length()) flacf->xiphComment()->addField("DATE", q2t(s.year)); //if (s.year.length()) flacf->xiphComment()->addField("RECORDING DATE", q2t(s.year)); if (s.genre.length()) flacf->xiphComment()->addField("GENRE", q2t(s.genre)); if (s.composer.length()) flacf->xiphComment()->addField("COMPOSER", q2t(s.composer)); if (s.author.length()) flacf->xiphComment()->addField("LYRICIST", q2t(s.author)); flacf->xiphComment()->addField("ALBUMARTIST", q2t(orchestra)); } if (TagLib::MP4::File* mp4f=dynamic_cast<TagLib::MP4::File*>(f.file())) { TagLib::MP4::Tag* tag=mp4f->tag(); if (tag) { TagLib::MP4::ItemListMap& map=tag->itemListMap(); /* for (TagLib::MP4::ItemListMap::ConstIterator it=map.begin();it!=map.end();++it) { qDebug()<<t2q((*it).first); TagLib::StringList list=(*it).second.toStringList(); for (int i=0;i<list.size();++i) qDebug()<<t2q(list[i]); } */ map.erase("aART"); map["\251day"]=TagLib::MP4::Item(TagLib::StringList(q2t(s.year))); if (s.composer.length()) map["\251wrt"]=TagLib::MP4::Item(TagLib::StringList(q2t(s.composer))); //f***s up tag in m4a file on windows //if (s.author.length()) // map["----:com.apple.iTunes:LYRICIST"]=TagLib::MP4::Item(TagLib::StringList(q2t(s.author))); //if (oldAlbum.length()) // map["----:com.apple.iTunes:ORIGINAL ALBUM"]=TagLib::MP4::Item(TagLib::StringList(q2t(oldAlbum))); if (!tag->save()) { failedFiles.append(s.matchedFileNames.at(fileI)); continue; } } } if (mpf || flacf) { TagLib::ID3v2::Tag* tag2=0; if (mpf) tag2=mpf->ID3v2Tag(true); if (flacf) tag2=flacf->ID3v2Tag(); //taglib may not be able to create it properly if (tag2) { TagLib::ID3v2::FrameListMap map=tag2->frameListMap(); /* for (TagLib::ID3v2::FrameListMap::ConstIterator it=map.begin();it!=map.end();++it) { qDebug()<<QByteArray((*it).first.data(), 4); TagLib::ID3v2::FrameList list=(*it).second; for (int i=0;i<list.size();++i) qDebug()<<t2q(list[i]->toString()); } */ //for preexisting bad tags if (map.contains("TIT2") && map["TIT2"].size()) if (TagLib::ID3v2::TextIdentificationFrame* f=dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(tag2->frameList("TIT2")[0])) f->setTextEncoding(TagLib::String::UTF8); if (map.contains("TALB") && map["TALB"].size()) if (TagLib::ID3v2::TextIdentificationFrame* f=dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(tag2->frameList("TALB")[0])) f->setTextEncoding(TagLib::String::UTF8); if (oldAlbum.length()) { if (!map.contains("TOAL")) { tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TOAL", TagLib::String::UTF8)); tag2->frameList("TOAL")[0]->setText(q2t(oldAlbum)); } //else // f.tag()->setAlbum(tag2->frameList("TOAL")[0]->toString()); } if (s.composer.length()) { if (!map.contains("TCOM")) tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TCOM", TagLib::String::UTF8)); else if (TagLib::ID3v2::TextIdentificationFrame* f=dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(tag2->frameList("TCOM")[0])) f->setTextEncoding(TagLib::String::UTF8); tag2->frameList("TCOM")[0]->setText(q2t(s.composer)); } if (s.author.length()) { if (!map.contains("TEXT")) tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TEXT", TagLib::String::UTF8)); else if (TagLib::ID3v2::TextIdentificationFrame* f=dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(tag2->frameList("TEXT")[0])) f->setTextEncoding(TagLib::String::UTF8); tag2->frameList("TEXT")[0]->setText(q2t(s.author)); } if (s.label.length()) { if (!map.contains("TPUB")) tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TPUB", TagLib::String::UTF8)); tag2->frameList("TPUB")[0]->setText(q2t(s.label)); } { if (!map.contains("TDRC")) tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TDRC", TagLib::String::UTF8)); tag2->frameList("TDRC")[0]->setText(q2t(s.year)); } if (orchestra.length()) { if (!map.contains("TPE2")) tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TPE2", TagLib::String::UTF8)); else if (TagLib::ID3v2::TextIdentificationFrame* f=dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(tag2->frameList("TPE2")[0])) f->setTextEncoding(TagLib::String::UTF8); tag2->frameList("TPE2")[0]->setText(q2t(orchestra)); } { if (!map.contains("TPE1")) tag2->addFrame(new TagLib::ID3v2::TextIdentificationFrame("TPE1", TagLib::String::UTF8)); else if (TagLib::ID3v2::TextIdentificationFrame* f=dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(tag2->frameList("TPE1")[0])) f->setTextEncoding(TagLib::String::UTF8); tag2->frameList("TPE1")[0]->setText(q2t(orchestra%" - "%s.vocal)); if (orchestra.isEmpty()) tag2->frameList("TPE1")[0]->setText(q2t(s.vocal)); } /* if (maxPop && s.popularity && map.contains("POPM")) { //if (!map.contains("POPM")) // tag2->addFrame(new TagLib::ID3v2::PopularimeterFrame()); TagLib::ID3v2::PopularimeterFrame* f=dynamic_cast<TagLib::ID3v2::PopularimeterFrame*> (tag2->frameList("POPM")[0]); //f->setRating(255*s.popularity/maxPop); //f->setEmail("*****@*****.**"); qDebug()<<"sss"<<(255*s.popularity/maxPop)<<f->rating()<<t2q(f->email()); } */ //tag2->removeFrames("TPE2"); } } if (!f.save()) failedFiles.append(s.matchedFileNames.at(fileI)); } } emit finished(); }