Commit 8f6d51b
committed
Qt: return const char* from enum-name lookup methods
Three MainWindow methods exist solely to map an enum value to a
fixed string literal: getThemeString, getCurrentViewTypeString,
and getCurrentThumbnailTypeString. They returned QString built
from a string literal at every call. Returning the literal
directly as const char* is one less heap allocation per call and
the caller (QSettings::setValue, which takes QVariant) accepts
it via the implicit QString conversion either way.
* getThemeString: 4 lines -> 1 line per branch.
* getCurrentViewTypeString: switch over a 2-value enum collapses
to an if.
* getCurrentThumbnailTypeString: dropped a dead trailing
'return QString("list")' that the compiler couldn't reach -
the THUMBNAIL_TYPE_BOXART branch already returned via the
default label.
No behaviour change. All four object files build with zero
warnings.1 parent 56e0592 commit 8f6d51b
2 files changed
Lines changed: 18 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2490 | 2490 | | |
2491 | 2491 | | |
2492 | 2492 | | |
2493 | | - | |
| 2493 | + | |
2494 | 2494 | | |
2495 | 2495 | | |
2496 | 2496 | | |
2497 | | - | |
2498 | | - | |
2499 | 2497 | | |
2500 | | - | |
| 2498 | + | |
2501 | 2499 | | |
2502 | | - | |
| 2500 | + | |
| 2501 | + | |
2503 | 2502 | | |
2504 | 2503 | | |
2505 | 2504 | | |
2506 | | - | |
| 2505 | + | |
2507 | 2506 | | |
2508 | 2507 | | |
2509 | 2508 | | |
| |||
3960 | 3959 | | |
3961 | 3960 | | |
3962 | 3961 | | |
3963 | | - | |
| 3962 | + | |
3964 | 3963 | | |
3965 | | - | |
3966 | | - | |
3967 | | - | |
3968 | | - | |
3969 | | - | |
3970 | | - | |
3971 | | - | |
3972 | | - | |
3973 | | - | |
3974 | | - | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
3975 | 3967 | | |
3976 | 3968 | | |
3977 | | - | |
| 3969 | + | |
3978 | 3970 | | |
3979 | 3971 | | |
3980 | 3972 | | |
3981 | 3973 | | |
3982 | | - | |
| 3974 | + | |
3983 | 3975 | | |
3984 | | - | |
| 3976 | + | |
3985 | 3977 | | |
3986 | | - | |
| 3978 | + | |
3987 | 3979 | | |
3988 | 3980 | | |
3989 | | - | |
| 3981 | + | |
3990 | 3982 | | |
3991 | | - | |
3992 | | - | |
| 3983 | + | |
3993 | 3984 | | |
3994 | 3985 | | |
3995 | 3986 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
| 477 | + | |
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
| 488 | + | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| |||
0 commit comments