MCPcopy Create free account
hub / github.com/KDE/kdiff3 / mainInit

Method mainInit

src/pdiff.cpp:74–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void KDiff3App::mainInit(TotalDiffStatus* pTotalDiffStatus, const InitFlags inFlags)
75{
76 ProgressScope pp;
77 bool bLoadFiles = inFlags & InitFlag::loadFiles;
78 bool bFirstRun = (m_sd1->isEmpty() && !m_sd1->hasData()) &&
79 (m_sd2->isEmpty() && !m_sd2->hasData()) &&
80 (m_sd3->isEmpty() && !m_sd3->hasData());
81 bool bVisibleMergeResultWindow = !m_outputFilename.isEmpty();
82 bool bUseCurrentEncoding = inFlags & InitFlag::useCurrentEncoding;
83 bool bAutoSolve = inFlags & InitFlag::autoSolve;
84 bool bGUI = (inFlags & InitFlag::initGUI);
85
86 IgnoreFlags eIgnoreFlags = IgnoreFlag::none;
87 if(gOptions->ignoreComments())
88 eIgnoreFlags |= IgnoreFlag::ignoreComments;
89
90 if(gOptions->whiteSpaceIsEqual())
91 eIgnoreFlags |= IgnoreFlag::ignoreWhiteSpace;
92
93 mErrors.clear();
94 assert(pTotalDiffStatus != nullptr);
95
96 //Easier to do here then have all eleven of our call points do the check.
97 if(bFirstRun)
98 bLoadFiles = false;
99
100 if(bGUI)
101 {
102 if(bVisibleMergeResultWindow && !gOptions->m_PreProcessorCmd.isEmpty())
103 {
104 QString msg = "- " + i18n("PreprocessorCmd: ") + gOptions->m_PreProcessorCmd + '\n';
105 KMessageBox::ButtonCode result = Compat::warningTwoActions(this,
106 i18n("The following option(s) you selected might change data:\n") + msg +
107 i18n("\nMost likely this is not wanted during a merge.\n"
108 "Do you want to disable these settings or continue with these settings active?"),
109 i18n("Option Unsafe for Merging"),
110 KGuiItem(i18n("Use These Options During Merge")),
111 KGuiItem(i18n("Disable Unsafe Options")));
112
113 if(result == Compat::SecondaryAction)
114 {
115 gOptions->m_PreProcessorCmd = "";
116 }
117 }
118
119 // Because of the progress dialog paint events can occur, but data is invalid,
120 // so painting must be suppressed
121 setLockPainting(true);
122 }
123
124 if(bLoadFiles)
125 {
126 resetDiffData();
127 if(m_sd3->isEmpty())
128 ProgressProxy::setMaxNofSteps(4); // Read 2 files, 1 comparison, 1 finediff
129 else
130 ProgressProxy::setMaxNofSteps(9); // Read 3 files, 3 comparisons, 3 finediffs
131

Callers

nothing calls this directly

Calls 15

warningTwoActionsFunction · 0.85
hasDataMethod · 0.80
ignoreCommentsMethod · 0.80
whiteSpaceIsEqualMethod · 0.80
getFilenameMethod · 0.80
readAndPreprocessMethod · 0.80
appendMethod · 0.80
setBinaryEqualABMethod · 0.80
isBinaryEqualWithMethod · 0.80
runDiffMethod · 0.80
getSizeLinesMethod · 0.80

Tested by

no test coverage detected