本文整理汇总了C++中Vocabulary::setDirty方法的典型用法代码示例。如果您正苦于以下问题:C++ Vocabulary::setDirty方法的具体用法?C++ Vocabulary::setDirty怎么用?C++ Vocabulary::setDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vocabulary
的用法示例。
在下文中一共展示了Vocabulary::setDirty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: editResultTerm
void SearchDialog::editResultTerm() {
ResultListItem* currItem = (ResultListItem*)resultsListView->currentItem();
if( currItem ) {
Term* term = currItem->getTerm();
if( term ) {
Vocabulary* vocab = controller->getVocabTree()->getVocabulary( term->getVocabId() );
TermDialog dialog( *vocab, controller, this, *term );
#if defined(Q_WS_HILDON)
dialog.showFullScreen();
#endif
int result = dialog.exec();
if( result ) {
Term newTerm = dialog.getTerm();
term->addTranslation( newTerm.getTranslation( controller->getPreferences().getFirstLanguage() ) );
term->addTranslation( newTerm.getTranslation( controller->getPreferences().getTestLanguage() ) );
BilingualKey commentKey( controller->getPreferences().getFirstLanguage(), controller->getPreferences().getTestLanguage() );
term->addComment( commentKey, newTerm.getComment( commentKey ) );
term->setImagePath( newTerm.getImagePath() );
currItem->updateUi();
vocab->setModificationDate( QDateTime::currentDateTime() );
vocab->setDirty( true );
}
}
}
}
示例2: editCurrentTerm
void QuizFrame::editCurrentTerm() {
if( controller->isQuizInProgress() ) {
Folder* vocabTree = controller->getVocabTree();
Term* term = controller->getCurrentTerm();
if( !term ) {
QMessageBox::warning( this, QObject::tr( "Information" ), tr( "DissociatedWord" ) );
return;
}
Vocabulary* vocab = vocabTree->getVocabulary( term->getVocabId() );
if( vocab == NULL || !vocab->isTermExists( term->getId() ) ) {
QMessageBox::warning( this, QObject::tr( "Information" ), tr( "DissociatedWord" ) );
return;
}
TermDialog dialog( *vocab, controller, this, *term );
int result = dialog.exec();
if( result ) {
QString firstLang( controller->getQuizFirstLanguage() );
QString testLang( controller->getQuizTestLanguage() );
Term newTerm = dialog.getTerm();
Translation firstLangTrans = newTerm.getTranslation( firstLang );
Translation testLangTrans = newTerm.getTranslation( testLang );
term->addTranslation( firstLangTrans );
term->addTranslation( testLangTrans );
BilingualKey commentKey( firstLang, testLang );
term->addComment( commentKey, newTerm.getComment( commentKey ) );
term->setImagePath( newTerm.getImagePath() );
vocab->setModificationDate( QDateTime::currentDateTime() );
vocab->setDirty( true );
setTerm( newTerm );
}
}
}
示例3: doRemoveTerms
void SearchDialog::doRemoveTerms( bool allowSelectTrans /* = true */, bool confirmBeforeRemove /* = true */ ) {
int selectedItemCount = 0;
// Find all the translation languages of the selected terms.
QStringList translationLanguages;
for( int i = 0; i < resultsListView->topLevelItemCount(); i++ ) {
ResultListItem* termItem = (ResultListItem*)resultsListView->topLevelItem( i );
if( termItem->isSelected() ) {
selectedItemCount++;
Term* term = termItem->getTerm();
for( Term::TranslationMap::ConstIterator it = term->translationsBegin(); it != term->translationsEnd(); it++ ) {
const Translation& trans = *it;
if( !translationLanguages.contains( trans.getLanguage() ) )
translationLanguages.append( trans.getLanguage() );
}
}
}
if( selectedItemCount == 0 )
return;
if( translationLanguages.count() <= 2 ) {
int response;
if( confirmBeforeRemove ) {
QMessageBox msgBox( QObject::tr( "Warning" ), tr( "ConfirmRemoveSelectedTerms" ),
QMessageBox::Warning,
QMessageBox::Yes,
QMessageBox::No | QMessageBox::Default | QMessageBox::Escape,
QMessageBox::NoButton,
this );
msgBox.setButtonText( QMessageBox::Yes, tr( "Yes" ) );
msgBox.setButtonText( QMessageBox::No, tr( "No" ) );
response = msgBox.exec();
}
else
response = QMessageBox::Yes;
if( response == QMessageBox::Yes ) {
for( int i = 0; i < resultsListView->topLevelItemCount(); i++ ) {
ResultListItem* termItem = (ResultListItem*)resultsListView->topLevelItem( i );
if( termItem->isSelected() ) {
Term* term = termItem->getTerm();
Vocabulary* vocab = controller->getVocabTree()->getVocabulary( term->getVocabId() );
if( !term->getImagePath().isNull() ) {
QDir imagePath( term->getImagePath() );
if( imagePath.isRelative() ) {
const QString& imagePath = controller->getApplicationDirName() + "/" + vocab->getParent()->getPath() +
"/v-" + QString::number( vocab->getId() ) + "/" + term->getImagePath();
QFile imageFile( imagePath );
if( imageFile.exists() ) {
if( !imageFile.remove() )
cerr << "Could not remove image " << qPrintable( imagePath ) << endl;
}
}
}
vocab->removeTerm( term->getId() );
delete( termItem );
vocab->setModificationDate( QDateTime::currentDateTime() );
vocab->setDirty( true );
}
}
resultsListView->clearSelection();
updateUi();
emit termsRemoved();
}
}
else {
int response;
QStringList selectedLanguages;
if( allowSelectTrans ) {
TranslationSelectionDialog msgBox( tr( "MultipleTranslationsDetectedForRemoveTermsCaption" ), tr( "MultipleTranslationsDetectedForRemoveTerms" ),
translationLanguages, TranslationSelectionDialog::selectionModeTargetLanguage, controller, this );
msgBox.setMaximumHeight( size().height() - 40 );
msgBox.setMaximumWidth( size().width() - 40 );
response = msgBox.exec();
if( response )
selectedLanguages = msgBox.getSelectedLanguages();
}
else {
selectedLanguages = QStringList();
selectedLanguages.append( controller->getPreferences().getFirstLanguage() );
selectedLanguages.append( controller->getPreferences().getTestLanguage() );
}
if( selectedLanguages.count() == 0 )
return;
for( int i = 0; i < resultsListView->topLevelItemCount(); i++ ) {
ResultListItem* termItem = (ResultListItem*)resultsListView->topLevelItem( i );
if( termItem->isSelected() ) {
Term* term = termItem->getTerm();
Vocabulary* vocab = controller->getVocabTree()->getVocabulary( term->getVocabId() );
for( QStringList::ConstIterator it = selectedLanguages.begin(); it != selectedLanguages.end(); it++ ) {
QString lang = *it;
term->removeTranslation( lang );
}
//.........这里部分代码省略.........