| 924 | } |
| 925 | |
| 926 | void SourceFormatterController::disableSourceFormatting() |
| 927 | { |
| 928 | Q_D(SourceFormatterController); |
| 929 | |
| 930 | d->enabled = false; |
| 931 | |
| 932 | if (d->sourceFormatters.empty()) { |
| 933 | return; |
| 934 | } |
| 935 | |
| 936 | decltype(d->sourceFormatters) loadedFormatters{}; |
| 937 | d->sourceFormatters.swap(loadedFormatters); |
| 938 | |
| 939 | resetUi(); |
| 940 | |
| 941 | for (auto* formatter : std::as_const(loadedFormatters)) { |
| 942 | emit formatterUnloading(formatter); |
| 943 | } |
| 944 | |
| 945 | Q_ASSERT(!loadedFormatters.empty()); |
| 946 | Q_ASSERT(d->sourceFormatters.empty()); |
| 947 | emit hasFormattersChanged(false); |
| 948 | } |
| 949 | |
| 950 | bool SourceFormatterController::sourceFormattingEnabled() |
| 951 | { |