Changeset View
Standalone View
plugins/qthelp/qthelpconfig.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 97 | { | |||
---|---|---|---|---|---|
114 | KNS3::Button *knsButton = new KNS3::Button(i18nc("Allow user to get some API documentation with GHNS", "Get New Documentation"), QStringLiteral("kdevelop-qthelp.knsrc"), m_configWidget->boxQchManage); | 114 | KNS3::Button *knsButton = new KNS3::Button(i18nc("Allow user to get some API documentation with GHNS", "Get New Documentation"), QStringLiteral("kdevelop-qthelp.knsrc"), m_configWidget->boxQchManage); | ||
115 | m_configWidget->tableCtrlLayout->insertWidget(1, knsButton); | 115 | m_configWidget->tableCtrlLayout->insertWidget(1, knsButton); | ||
116 | connect(knsButton, &KNS3::Button::dialogFinished, this, &QtHelpConfig::knsUpdate); | 116 | connect(knsButton, &KNS3::Button::dialogFinished, this, &QtHelpConfig::knsUpdate); | ||
117 | connect(m_configWidget->loadQtDocsCheckBox, &QCheckBox::toggled, | 117 | connect(m_configWidget->loadQtDocsCheckBox, &QCheckBox::toggled, | ||
118 | this, static_cast<void(QtHelpConfig::*)()>(&QtHelpConfig::changed)); | 118 | this, static_cast<void(QtHelpConfig::*)()>(&QtHelpConfig::changed)); | ||
119 | m_configWidget->qchSearchDir->setMode(KFile::Directory); | 119 | m_configWidget->qchSearchDir->setMode(KFile::Directory); | ||
120 | connect(m_configWidget->qchSearchDir, &KUrlRequester::textChanged, | 120 | connect(m_configWidget->qchSearchDir, &KUrlRequester::textChanged, | ||
121 | this, &QtHelpConfig::changed); | 121 | this, &QtHelpConfig::changed); | ||
122 | connect(m_configWidget->externalViewerCheckBox, &QCheckBox::toggled, | ||||
123 | this, static_cast<void(QtHelpConfig::*)()>(&QtHelpConfig::changed)); | ||||
124 | m_configWidget->externalViewerCheckBox->setToolTip(i18n("Use Qt's Assistant as an external viewer,\n" | ||||
125 | "called through a script or symlink \"kdevelop-qthelp-viewer\"")); | ||||
kfunk: This is over-engineered. No one will find or use that feature.
This should call `assistant`… | |||||
Yeah, this works for me and as a PoC, not as a definitive solution. From having used this patch for months I would now suggest to let the user select the path to the assistant to be used. The checkbox in the config dialog thus becomes a path selector, and not setting that path will then equal not activating external viewer support. Figuring out the Qt prefix used by the project seems unnecessarily complex (if not only when there are multiple projects in a session), and I don't think there's something like a system-wide assistant even on Plasma desktops. This is even more true on Mac where the assistant executable lives in an app bundle that could be everywhere. Another thing to keep in mind is that the assistant remote control protocol doesn't allow to change collections on the fly. That's why I currently use a script: it allowed me to set up a help collection for Assistant that corresponds to the one KDevelop works with (which isn't an actual qhc collection as far as I understand). That allows me to a single assistant copy. rjvbb: Yeah, this works for me and as a PoC, not as a definitive solution.
From having used this… | |||||
122 | 126 | | |||
123 | // Set availability information for QtHelp | 127 | // Set availability information for QtHelp | ||
124 | m_configWidget->messageAvailabilityQtDocs->setCloseButtonVisible(false); | 128 | m_configWidget->messageAvailabilityQtDocs->setCloseButtonVisible(false); | ||
125 | if(plugin->isQtHelpAvailable()) { | 129 | if(plugin->isQtHelpAvailable()) { | ||
126 | m_configWidget->messageAvailabilityQtDocs->setVisible(false); | 130 | m_configWidget->messageAvailabilityQtDocs->setVisible(false); | ||
127 | } else { | 131 | } else { | ||
128 | m_configWidget->messageAvailabilityQtDocs->setText( | 132 | m_configWidget->messageAvailabilityQtDocs->setText( | ||
129 | i18n("The command \"qmake -query\" could not provide a path to a QtHelp file (QCH).")); | 133 | i18n("The command \"qmake -query\" could not provide a path to a QtHelp file (QCH).")); | ||
130 | m_configWidget->loadQtDocsCheckBox->setVisible(false); | 134 | m_configWidget->loadQtDocsCheckBox->setVisible(false); | ||
135 | m_configWidget->externalViewerCheckBox->setVisible(false); | ||||
131 | } | 136 | } | ||
132 | reset(); | 137 | reset(); | ||
133 | } | 138 | } | ||
134 | 139 | | |||
135 | QtHelpConfig::~QtHelpConfig() | 140 | QtHelpConfig::~QtHelpConfig() | ||
136 | { | 141 | { | ||
137 | delete m_configWidget; | 142 | delete m_configWidget; | ||
138 | } | 143 | } | ||
Show All 10 Lines | 153 | for (int i = 0; i < m_configWidget->qchTable->topLevelItemCount(); i++) { | |||
149 | const QTreeWidgetItem* item = m_configWidget->qchTable->topLevelItem(i); | 154 | const QTreeWidgetItem* item = m_configWidget->qchTable->topLevelItem(i); | ||
150 | nameList << item->text(0); | 155 | nameList << item->text(0); | ||
151 | pathList << item->text(1); | 156 | pathList << item->text(1); | ||
152 | iconList << item->text(2); | 157 | iconList << item->text(2); | ||
153 | ghnsList << item->text(3); | 158 | ghnsList << item->text(3); | ||
154 | } | 159 | } | ||
155 | QString searchDir = m_configWidget->qchSearchDir->text(); | 160 | QString searchDir = m_configWidget->qchSearchDir->text(); | ||
156 | bool loadQtDoc = m_configWidget->loadQtDocsCheckBox->isChecked(); | 161 | bool loadQtDoc = m_configWidget->loadQtDocsCheckBox->isChecked(); | ||
162 | bool extViewer = m_configWidget->externalViewerCheckBox->isChecked(); | ||||
157 | 163 | | |||
158 | qtHelpWriteConfig(iconList, nameList, pathList, ghnsList, searchDir, loadQtDoc); | 164 | qtHelpWriteConfig(iconList, nameList, pathList, ghnsList, searchDir, loadQtDoc, extViewer); | ||
159 | static_cast<QtHelpPlugin*>(plugin())->readConfig(); | 165 | static_cast<QtHelpPlugin*>(plugin())->readConfig(); | ||
160 | } | 166 | } | ||
161 | 167 | | |||
162 | void QtHelpConfig::reset() | 168 | void QtHelpConfig::reset() | ||
163 | { | 169 | { | ||
164 | m_configWidget->qchTable->clear(); | 170 | m_configWidget->qchTable->clear(); | ||
165 | 171 | | |||
166 | QStringList iconList, nameList, pathList, ghnsList; | 172 | QStringList iconList, nameList, pathList, ghnsList; | ||
167 | QString searchDir; | 173 | QString searchDir; | ||
168 | bool loadQtDoc; | 174 | bool loadQtDoc, extViewer; | ||
169 | qtHelpReadConfig(iconList, nameList, pathList, ghnsList, searchDir, loadQtDoc); | 175 | qtHelpReadConfig(iconList, nameList, pathList, ghnsList, searchDir, loadQtDoc, extViewer); | ||
170 | 176 | | |||
171 | const int size = qMin(qMin(iconList.size(), nameList.size()), pathList.size()); | 177 | const int size = qMin(qMin(iconList.size(), nameList.size()), pathList.size()); | ||
172 | for(int i = 0; i < size; ++i) { | 178 | for(int i = 0; i < size; ++i) { | ||
173 | QString ghnsStatus = ghnsList.size()>i ? ghnsList.at(i) : QStringLiteral("0"); | 179 | QString ghnsStatus = ghnsList.size()>i ? ghnsList.at(i) : QStringLiteral("0"); | ||
174 | addTableItem(iconList.at(i), nameList.at(i), pathList.at(i), ghnsStatus); | 180 | addTableItem(iconList.at(i), nameList.at(i), pathList.at(i), ghnsStatus); | ||
175 | } | 181 | } | ||
176 | m_configWidget->qchSearchDir->setText(searchDir); | 182 | m_configWidget->qchSearchDir->setText(searchDir); | ||
177 | m_configWidget->loadQtDocsCheckBox->setChecked(loadQtDoc); | 183 | m_configWidget->loadQtDocsCheckBox->setChecked(loadQtDoc); | ||
184 | m_configWidget->externalViewerCheckBox->setChecked(extViewer); | ||||
178 | 185 | | |||
179 | emit changed(); | 186 | emit changed(); | ||
180 | } | 187 | } | ||
181 | 188 | | |||
182 | void QtHelpConfig::defaults() | 189 | void QtHelpConfig::defaults() | ||
183 | { | 190 | { | ||
184 | bool change = false; | 191 | bool change = false; | ||
185 | if(m_configWidget->qchTable->topLevelItemCount() > 0) { | 192 | if(m_configWidget->qchTable->topLevelItemCount() > 0) { | ||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |
This is over-engineered. No one will find or use that feature.
This should call assistant directly, if at all.` The path to assistant can be deduced from the Qt prefix used by the project and use system-wide assistant as a fallack.