26
26
#include < QDir>
27
27
#include < QFile>
28
28
#include < QFileInfo>
29
- #include < QListIterator>
30
- #include < QSetIterator>
31
- #include < QStringListIterator>
32
29
33
30
#if defined(Q_OS_UNIX) && defined(WITH_X11)
34
31
#include " x11extras.h"
@@ -213,11 +210,8 @@ void AutoProfileWatcher::runAppCheck()
213
210
214
211
bool hasOnePartName = false ;
215
212
216
- QListIterator<AutoProfileInfo *> iterList (iter.value ());
217
- while (iterList.hasNext ())
213
+ for (auto autoInfo : iter.value ())
218
214
{
219
- AutoProfileInfo *autoInfo = iterList.next ();
220
-
221
215
if (autoInfo->isPartialState ())
222
216
{
223
217
hasOnePartName = true ;
@@ -275,10 +269,8 @@ void AutoProfileWatcher::runAppCheck()
275
269
QHash<QString, int > highestMatchCount;
276
270
QHash<QString, AutoProfileInfo *> highestMatches;
277
271
278
- QSetIterator<AutoProfileInfo *> fullSetIter (fullSet);
279
- while (fullSetIter.hasNext ())
272
+ for (auto &&info : fullSet)
280
273
{
281
- AutoProfileInfo *info = fullSetIter.next ();
282
274
if (info->isActive ())
283
275
{
284
276
int numProps = 0 ;
@@ -317,11 +309,8 @@ void AutoProfileWatcher::runAppCheck()
317
309
}
318
310
}
319
311
320
- QHashIterator<QString, AutoProfileInfo *> highIter (highestMatches);
321
-
322
- while (highIter.hasNext ())
312
+ for (auto &&info : highestMatches)
323
313
{
324
- AutoProfileInfo *info = highIter.next ().value ();
325
314
getUniqeIDSetLocal ().insert (info->getUniqueID ());
326
315
emit foundApplicableProfile (info);
327
316
}
@@ -333,13 +322,8 @@ void AutoProfileWatcher::runAppCheck()
333
322
emit foundApplicableProfile (allDefaultInfo);
334
323
}
335
324
336
- QHashIterator<QString, AutoProfileInfo *> iter (getDefaultProfileAssignments ());
337
-
338
- while (iter.hasNext ())
325
+ for (auto &&info : getDefaultProfileAssignments ())
339
326
{
340
- iter.next ();
341
- AutoProfileInfo *info = iter.value ();
342
-
343
327
if (info->isActive () && !getUniqeIDSetLocal ().contains (info->getUniqueID ()))
344
328
{
345
329
emit foundApplicableProfile (info);
@@ -381,11 +365,8 @@ void AutoProfileWatcher::syncProfileAssignment()
381
365
}
382
366
383
367
// Handle device specific Default profile assignments
384
- QStringListIterator iter (registeredUniques);
385
-
386
- while (iter.hasNext ())
368
+ for (auto &&tempkey : registeredUniques)
387
369
{
388
- QString tempkey = iter.next ();
389
370
QString uniqueID = QString (tempkey).replace (" UniqueID" , " " );
390
371
QString profile = settings->value (QString (" DefaultAutoProfile-%1/Profile" ).arg (uniqueID), " " ).toString ();
391
372
QString active = settings->value (QString (" DefaultAutoProfile-%1/Active" ).arg (uniqueID), " " ).toString ();
@@ -529,65 +510,51 @@ void AutoProfileWatcher::syncProfileAssignment()
529
510
void AutoProfileWatcher::clearProfileAssignments ()
530
511
{
531
512
QSet<AutoProfileInfo *> terminateProfiles;
532
- QListIterator<QList<AutoProfileInfo *>> iterDelete (appProfileAssignments.values ());
533
513
534
- while (iterDelete. hasNext ())
514
+ for ( const auto &profileList : appProfileAssignments. values ())
535
515
{
536
- QList<AutoProfileInfo *> templist = iterDelete.next ();
537
516
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
538
- terminateProfiles.unite (QSet<AutoProfileInfo *>(templist .begin (), templist .end ()));
517
+ terminateProfiles.unite (QSet<AutoProfileInfo *>(profileList .begin (), profileList .end ()));
539
518
#else
540
- terminateProfiles.unite (templist .toSet ());
519
+ terminateProfiles.unite (profileList .toSet ());
541
520
#endif
542
521
}
543
522
544
523
appProfileAssignments.clear ();
545
524
546
- QListIterator<QList<AutoProfileInfo *>> iterClassDelete (windowClassProfileAssignments.values ());
547
-
548
- while (iterClassDelete.hasNext ())
525
+ for (const auto &profileList : windowClassProfileAssignments.values ())
549
526
{
550
- QList<AutoProfileInfo *> templist = iterClassDelete.next ();
551
527
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
552
- terminateProfiles.unite (QSet<AutoProfileInfo *>(templist .begin (), templist .end ()));
528
+ terminateProfiles.unite (QSet<AutoProfileInfo *>(profileList .begin (), profileList .end ()));
553
529
#else
554
- terminateProfiles.unite (templist .toSet ());
530
+ terminateProfiles.unite (profileList .toSet ());
555
531
#endif
556
532
}
557
533
558
534
windowClassProfileAssignments.clear ();
559
535
560
- QListIterator<QList<AutoProfileInfo *>> iterNameDelete (windowNameProfileAssignments.values ());
561
-
562
- while (iterNameDelete.hasNext ())
536
+ for (const auto &profileList : windowNameProfileAssignments.values ())
563
537
{
564
- QList<AutoProfileInfo *> templist = iterNameDelete.next ();
565
538
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
566
- terminateProfiles.unite (QSet<AutoProfileInfo *>(templist .begin (), templist .end ()));
539
+ terminateProfiles.unite (QSet<AutoProfileInfo *>(profileList .begin (), profileList .end ()));
567
540
#else
568
- terminateProfiles.unite (templist .toSet ());
541
+ terminateProfiles.unite (profileList .toSet ());
569
542
#endif
570
543
}
571
544
572
545
windowNameProfileAssignments.clear ();
573
546
574
- QSetIterator<AutoProfileInfo *> iterTerminate (terminateProfiles);
575
-
576
- while (iterTerminate.hasNext ())
547
+ for (auto *info : terminateProfiles)
577
548
{
578
- AutoProfileInfo *info = iterTerminate.next ();
579
549
if (info != nullptr )
580
550
{
581
551
info->deleteLater ();
582
552
info = nullptr ;
583
553
}
584
554
}
585
555
586
- QListIterator<AutoProfileInfo *> iterDefaultsDelete (getDefaultProfileAssignments ().values ());
587
-
588
- while (iterDefaultsDelete.hasNext ())
556
+ for (auto *info : getDefaultProfileAssignments ().values ())
589
557
{
590
- AutoProfileInfo *info = iterDefaultsDelete.next ();
591
558
if (info != nullptr )
592
559
{
593
560
info->deleteLater ();
0 commit comments