| 120 | } |
| 121 | |
| 122 | void MainWindow::initializeApp() |
| 123 | { |
| 124 | // inform us when a link in the table of contents or preview view is clicked |
| 125 | ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); |
| 126 | ui->tocWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); |
| 127 | |
| 128 | // set last used style |
| 129 | lastUsedStyle(); |
| 130 | |
| 131 | ui->plainTextEdit->tabWidthChanged(options->tabWidth()); |
| 132 | |
| 133 | // init extension flags |
| 134 | ui->actionAutolink->setChecked(options->isAutolinkEnabled()); |
| 135 | ui->actionStrikethroughOption->setChecked(options->isStrikethroughEnabled()); |
| 136 | ui->actionAlphabeticLists->setChecked(options->isAlphabeticListsEnabled()); |
| 137 | ui->actionDefinitionLists->setChecked(options->isDefinitionListsEnabled()); |
| 138 | ui->actionSmartyPants->setChecked(options->isSmartyPantsEnabled()); |
| 139 | ui->actionFootnotes->setChecked(options->isFootnotesEnabled()); |
| 140 | ui->actionSuperscript->setChecked(options->isSuperscriptEnabled()); |
| 141 | |
| 142 | // init option flags |
| 143 | ui->actionMathSupport->setChecked(options->isMathSupportEnabled()); |
| 144 | ui->actionDiagramSupport->setChecked(options->isDiagramSupportEnabled()); |
| 145 | ui->actionCodeHighlighting->setChecked(options->isCodeHighlightingEnabled()); |
| 146 | ui->actionShowSpecialCharacters->setChecked(options->isShowSpecialCharactersEnabled()); |
| 147 | ui->actionWordWrap->setChecked(options->isWordWrapEnabled()); |
| 148 | ui->actionCheckSpelling->setChecked(options->isSpellingCheckEnabled()); |
| 149 | ui->plainTextEdit->setSpellingCheckEnabled(options->isSpellingCheckEnabled()); |
| 150 | ui->actionYamlHeaderSupport->setChecked(options->isYamlHeaderSupportEnabled()); |
| 151 | |
| 152 | // set url to markdown syntax help |
| 153 | ui->webView_2->setUrl(tr("qrc:/syntax.html")); |
| 154 | |
| 155 | // allow loading of remote javascript |
| 156 | QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); |
| 157 | |
| 158 | ui->webView->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); |
| 159 | QWebInspector *inspector = new QWebInspector(); |
| 160 | inspector->setPage(ui->webView->page()); |
| 161 | |
| 162 | loadCustomStyles(); |
| 163 | ui->menuLanguages->loadDictionaries(options->dictionaryLanguage()); |
| 164 | |
| 165 | //: path to built-in snippets resource. |
| 166 | JsonFile<Snippet>::load(":/markdown-snippets.json", snippetCollection); |
| 167 | QString path = DataLocation::writableLocation(); |
| 168 | JsonFile<Snippet>::load(path + "/user-snippets.json", snippetCollection); |
| 169 | |
| 170 | // setup file explorer |
| 171 | connect(ui->fileExplorerDockContents, SIGNAL(fileSelected(QString)), |
| 172 | this, SLOT(openRecentFile(QString))); |
| 173 | |
| 174 | // setup jump list on windows |
| 175 | #ifdef Q_OS_WIN |
| 176 | QWinJumpList jumplist; |
| 177 | jumplist.recent()->setVisible(true); |
| 178 | #endif |
| 179 |
nothing calls this directly
no test coverage detected