MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / init

Method init

src/NotepadNextApplication.cpp:85–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85bool NotepadNextApplication::init()
86{
87 qInfo(Q_FUNC_INFO);
88
89#ifndef Q_OS_MACOS
90 setWindowIcon(QIcon(QStringLiteral(":/icons/NotepadNext.png")));
91#endif
92
93 settings = new ApplicationSettings(this);
94
95 if (parser.isSet("reset-settings")) {
96 QFileInfo original(settings->fileName());
97 const QString backup = original.canonicalFilePath() + QStringLiteral(".backup");
98
99 qInfo("Resetting application settings");
100 qInfo("Backuping up %s to %s", qUtf8Printable(settings->fileName()), qUtf8Printable(backup));
101
102 QFile::remove(backup);
103 QFile::rename(settings->fileName(), backup);
104
105 settings->clear();
106 }
107
108 // Translation files are stored as a qresource
109 translationManager = new TranslationManager(this, QStringLiteral(":/i18n/"));
110
111 // The command line overrides the settings
112 if (!parser.value("translation").isEmpty()) {
113 translationManager->loadTranslation(parser.value("translation"));
114 }
115 else if (!settings->translation().isEmpty()){
116 translationManager->loadTranslation(settings->translation());
117 }
118 else {
119 translationManager->loadSystemDefaultTranslation();
120 }
121
122 // This connection isn't needed since the application can not appropriately retranslate the UI at runtime
123 //connect(settings, &ApplicationSettings::translationChanged, translationManager, &TranslationManager::loadTranslationByName);
124
125 luaState = new LuaState();
126
127 recentFilesListManager = new RecentFilesListManager(this);
128 editorManager = new EditorManager(settings, this);
129 sessionManager = new SessionManager(this);
130
131 connect(editorManager, &EditorManager::editorCreated, recentFilesListManager, [=](ScintillaNext *editor) {
132 if (editor->isFile()) {
133 recentFilesListManager->removeFile(editor->getFilePath());
134 }
135 });
136
137 connect(editorManager, &EditorManager::editorClosed, recentFilesListManager, [=](ScintillaNext *editor) {
138 if (editor->isFile()) {
139 recentFilesListManager->addFile(editor->getFilePath());
140 }
141 });
142

Callers 1

mainFunction · 0.80

Calls 15

toLocalFileNameFunction · 0.85
isEmptyMethod · 0.80
loadTranslationMethod · 0.80
isFileMethod · 0.80
removeFileMethod · 0.80
getFilePathMethod · 0.80
addFileMethod · 0.80
executeFileMethod · 0.80
InitialiseMethod · 0.80
loadSessionMethod · 0.80
lengthMethod · 0.80

Tested by

no test coverage detected