diff --git a/config.cc b/config.cc index c035c77c..5d373ab7 100644 --- a/config.cc +++ b/config.cc @@ -143,17 +143,17 @@ Romaji::Romaji(): Group * Class::getGroup( unsigned id ) { - for( unsigned x = 0; x < groups.size(); x++ ) - if( groups[ x ].id == id ) + for( int x = 0; x < groups.size(); x++ ) + if( groups.at( x ).id == id ) return &groups[ x ]; return 0; } Group const * Class::getGroup( unsigned id ) const { - for( unsigned x = 0; x < groups.size(); x++ ) - if( groups[ x ].id == id ) - return &groups[ x ]; + for( int x = 0; x < groups.size(); x++ ) + if( groups.at( x ).id == id ) + return &groups.at( x ); return 0; } @@ -795,7 +795,7 @@ void saveGroup( Group const & data, QDomElement & group ) group.setAttributeNode( shortcut ); } - for( vector< DictionaryRef >::const_iterator j = data.dictionaries.begin(); j != data.dictionaries.end(); ++j ) + for( QVector< DictionaryRef >::const_iterator j = data.dictionaries.begin(); j != data.dictionaries.end(); ++j ) { QDomElement dictionary = dd.createElement( "dictionary" ); @@ -924,10 +924,10 @@ void save( Class const & c ) throw( exError ) hunspell.setAttributeNode( path ); root.appendChild( hunspell ); - for( unsigned x = 0; x < c.hunspell.enabledDictionaries.size(); ++x ) + for( int x = 0; x < c.hunspell.enabledDictionaries.size(); ++x ) { QDomElement en = dd.createElement( "enabled" ); - QDomText value = dd.createTextNode( c.hunspell.enabledDictionaries[ x ] ); + QDomText value = dd.createTextNode( c.hunspell.enabledDictionaries.at( x ) ); en.appendChild( value ); hunspell.appendChild( en ); diff --git a/config.hh b/config.hh index 830d3474..b4d2e577 100644 --- a/config.hh +++ b/config.hh @@ -4,7 +4,7 @@ #ifndef __CONFIG_HH_INCLUDED__ #define __CONFIG_HH_INCLUDED__ -#include +#include #include #include #include @@ -15,8 +15,6 @@ /// GoldenDict's configuration namespace Config { -using std::vector; - /// Dictionaries which are temporarily disabled via the dictionary bar. typedef QSet< QString > MutedDictionaries; @@ -39,7 +37,7 @@ struct Path }; /// A list of paths where to search for the dictionaries -typedef vector< Path > Paths; +typedef QVector< Path > Paths; /// A directory holding bunches of audiofiles, which is indexed into a separate /// dictionary. @@ -59,7 +57,7 @@ struct SoundDir }; /// A list of SoundDirs -typedef vector< SoundDir > SoundDirs; +typedef QVector< SoundDir > SoundDirs; struct DictionaryRef { @@ -83,7 +81,7 @@ struct Group QString name, icon; QByteArray iconData; QKeySequence shortcut; - vector< DictionaryRef > dictionaries; + QVector< DictionaryRef > dictionaries; Config::MutedDictionaries mutedDictionaries; // Disabled via dictionary bar Config::MutedDictionaries popupMutedDictionaries; // Disabled via dictionary bar in popup @@ -101,7 +99,7 @@ struct Group }; /// All the groups -struct Groups: public vector< Group > +struct Groups: public QVector< Group > { unsigned nextId; // Id to use to create the group next time @@ -239,14 +237,14 @@ struct WebSite }; /// All the WebSites -typedef vector< WebSite > WebSites; +typedef QVector< WebSite > WebSites; /// Hunspell configuration struct Hunspell { QString dictionariesPath; - typedef vector< QString > Dictionaries; + typedef QVector< QString > Dictionaries; Dictionaries enabledDictionaries; @@ -259,7 +257,7 @@ struct Hunspell }; /// All the MediaWikis -typedef vector< MediaWiki > MediaWikis; +typedef QVector< MediaWiki > MediaWikis; /// Romaji transliteration configuration struct Romaji @@ -364,7 +362,7 @@ struct Program { return ! operator == ( other ); } }; -typedef vector< Program > Programs; +typedef QVector< Program > Programs; struct Class { diff --git a/groups.cc b/groups.cc index 439215c5..3769a0c8 100644 --- a/groups.cc +++ b/groups.cc @@ -48,7 +48,7 @@ Groups::Groups( QWidget * parent, void Groups::editGroup( unsigned id ) { - for( unsigned x = 0; x < groups.size(); ++x ) + for( int x = 0; x < groups.size(); ++x ) { if ( groups[ x ].id == id ) { diff --git a/groups_widgets.cc b/groups_widgets.cc index d1edddb0..b46a0709 100644 --- a/groups_widgets.cc +++ b/groups_widgets.cc @@ -497,7 +497,7 @@ void DictGroupsWidget::populate( Config::Groups const & groups, allDicts = &allDicts_; - for( unsigned x = 0; x < groups.size(); ++x ) + for( int x = 0; x < groups.size(); ++x ) addTab( new DictGroupWidget( this, *allDicts, groups[ x ] ), escapeAmps( groups[ x ].name ) ); nextId = groups.nextId; diff --git a/hunspell.cc b/hunspell.cc index 7d7a7113..44669c63 100644 --- a/hunspell.cc +++ b/hunspell.cc @@ -688,7 +688,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::Hunspell const & c vector< DataFiles > dataFiles = findDataFiles( cfg.dictionariesPath ); - for( unsigned x = 0; x < cfg.enabledDictionaries.size(); ++x ) + for( int x = 0; x < cfg.enabledDictionaries.size(); ++x ) { for( unsigned d = dataFiles.size(); d--; ) { diff --git a/instances.cc b/instances.cc index 5982c31e..a9af71ae 100644 --- a/instances.cc +++ b/instances.cc @@ -20,7 +20,7 @@ Group::Group( Config::Group const & cfgGroup, if ( !cfgGroup.iconData.isEmpty() ) iconData = iconFromData( cfgGroup.iconData ); - for( unsigned x = 0; x < cfgGroup.dictionaries.size(); ++x ) + for( unsigned x = 0; x < (unsigned)cfgGroup.dictionaries.size(); ++x ) { std::string id = cfgGroup.dictionaries[ x ].id.toStdString(); @@ -53,10 +53,10 @@ Group::Group( Config::Group const & cfgGroup, if( n < dictionaries.size() ) continue; - for( n = x + 1; n < cfgGroup.dictionaries.size(); n++ ) + for( n = x + 1; n < (unsigned)cfgGroup.dictionaries.size(); n++ ) if( cfgGroup.dictionaries[ n ].name == qname ) break; - if( n < cfgGroup.dictionaries.size() ) + if( n < (unsigned)cfgGroup.dictionaries.size() ) continue; for( unsigned y = 0; y < allDictionaries.size(); ++y ) @@ -179,7 +179,7 @@ void updateNames( Config::Group & group, void updateNames( Config::Groups & groups, vector< sptr< Dictionary::Class > > const & allDictionaries ) { - for( unsigned x = 0; x < groups.size(); ++x ) + for( int x = 0; x < groups.size(); ++x ) updateNames( groups[ x ], allDictionaries ); } diff --git a/mainwindow.cc b/mainwindow.cc index 695fc104..b2c858ed 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -826,7 +826,7 @@ void MainWindow::updateGroupList() groupInstances.push_back( g ); } - for( unsigned x = 0; x < cfg.groups.size(); ++x ) + for( int x = 0; x < cfg.groups.size(); ++x ) groupInstances.push_back( Instances::Group( cfg.groups[ x ], dictionaries ) ); // Update names for dictionaries that are present, so that they could be @@ -1382,7 +1382,7 @@ void MainWindow::editDictionaries( unsigned editDictionaryGroup ) { // Set muted dictionaries from old groups - for( unsigned x = 0; x < newCfg.groups.size(); x++ ) + for( int x = 0; x < newCfg.groups.size(); x++ ) { unsigned id = newCfg.groups[ x ].id; if( id != Instances::Group::NoGroupId ) diff --git a/mediawiki.cc b/mediawiki.cc index 9860122a..a44cabf8 100644 --- a/mediawiki.cc +++ b/mediawiki.cc @@ -422,7 +422,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( { vector< sptr< Dictionary::Class > > result; - for( unsigned x = 0; x < wikis.size(); ++x ) + for( int x = 0; x < wikis.size(); ++x ) { if ( wikis[ x ].enabled ) result.push_back( new MediaWikiDictionary( wikis[ x ].id.toStdString(), diff --git a/sources.cc b/sources.cc index 14946ea9..dc69fc60 100644 --- a/sources.cc +++ b/sources.cc @@ -406,7 +406,7 @@ QVariant MediaWikisModel::headerData( int section, Qt::Orientation /*orientation QVariant MediaWikisModel::data( QModelIndex const & index, int role ) const { - if ( (unsigned)index.row() >= mediawikis.size() ) + if ( index.row() >= mediawikis.size() ) return QVariant(); if ( role == Qt::DisplayRole || role == Qt::EditRole ) @@ -433,7 +433,7 @@ QVariant MediaWikisModel::data( QModelIndex const & index, int role ) const bool MediaWikisModel::setData( QModelIndex const & index, const QVariant & value, int role ) { - if ( (unsigned)index.row() >= mediawikis.size() ) + if ( index.row() >= mediawikis.size() ) return false; if ( role == Qt::CheckStateRole && !index.column() ) @@ -563,7 +563,7 @@ QVariant WebSitesModel::headerData( int section, Qt::Orientation /*orientation*/ QVariant WebSitesModel::data( QModelIndex const & index, int role ) const { - if ( (unsigned)index.row() >= webSites.size() ) + if ( index.row() >= webSites.size() ) return QVariant(); if ( role == Qt::DisplayRole || role == Qt::EditRole ) @@ -590,7 +590,7 @@ QVariant WebSitesModel::data( QModelIndex const & index, int role ) const bool WebSitesModel::setData( QModelIndex const & index, const QVariant & value, int role ) { - if ( (unsigned)index.row() >= webSites.size() ) + if ( index.row() >= webSites.size() ) return false; if ( role == Qt::CheckStateRole && !index.column() ) @@ -722,7 +722,7 @@ QVariant ProgramsModel::headerData( int section, Qt::Orientation /*orientation*/ QVariant ProgramsModel::data( QModelIndex const & index, int role ) const { - if ( (unsigned) index.row() >= programs.size() ) + if ( index.row() >= programs.size() ) return QVariant(); if ( role == Qt::DisplayRole || role == Qt::EditRole ) @@ -754,7 +754,7 @@ QVariant ProgramsModel::data( QModelIndex const & index, int role ) const bool ProgramsModel::setData( QModelIndex const & index, const QVariant & value, int role ) { - if ( (unsigned)index.row() >= programs.size() ) + if ( index.row() >= programs.size() ) return false; if ( role == Qt::CheckStateRole && !index.column() ) @@ -900,7 +900,7 @@ QVariant PathsModel::headerData( int section, Qt::Orientation /*orientation*/, i QVariant PathsModel::data( QModelIndex const & index, int role ) const { - if ( (unsigned)index.row() >= paths.size() ) + if ( index.row() >= paths.size() ) return QVariant(); if ( ( role == Qt::DisplayRole || role == Qt::EditRole ) && !index.column() ) @@ -915,7 +915,7 @@ QVariant PathsModel::data( QModelIndex const & index, int role ) const bool PathsModel::setData( QModelIndex const & index, const QVariant & /*value*/, int role ) { - if ( (unsigned)index.row() >= paths.size() ) + if ( index.row() >= paths.size() ) return false; if ( role == Qt::CheckStateRole && index.column() == 1 ) @@ -1006,7 +1006,7 @@ QVariant SoundDirsModel::headerData( int section, Qt::Orientation /*orientation* QVariant SoundDirsModel::data( QModelIndex const & index, int role ) const { - if ( (unsigned)index.row() >= soundDirs.size() ) + if ( index.row() >= soundDirs.size() ) return QVariant(); if ( ( role == Qt::DisplayRole || role == Qt::EditRole ) && !index.column() ) @@ -1021,7 +1021,7 @@ QVariant SoundDirsModel::data( QModelIndex const & index, int role ) const bool SoundDirsModel::setData( QModelIndex const & index, const QVariant & value, int role ) { - if ( (unsigned)index.row() >= soundDirs.size() ) + if ( index.row() >= soundDirs.size() ) return false; if ( ( role == Qt::DisplayRole || role == Qt::EditRole ) && index.column() < 2 ) diff --git a/website.cc b/website.cc index 68b8f7c0..489578a5 100644 --- a/website.cc +++ b/website.cc @@ -142,7 +142,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::WebSites const & w { vector< sptr< Dictionary::Class > > result; - for( unsigned x = 0; x < ws.size(); ++x ) + for( int x = 0; x < ws.size(); ++x ) { if ( ws[ x ].enabled ) result.push_back( new WebSiteDictionary( ws[ x ].id.toUtf8().data(),